

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" href="/img/favicon.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Fly542">
  <meta name="keywords" content="">
  
    <meta name="description" content="DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION (域名 - 实施和规范) 1. STATUS OF THIS MEMO(此备忘录的状态)This RFC describes the details of the domain system and protocol, and assumes that the reader is familiar wi">
<meta property="og:type" content="article">
<meta property="og:title" content="RFC1035(域名 - 实施和规范)">
<meta property="og:url" content="http://fly542.cn/2023/08/10/03%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91/03linux/21-rfc1035/index.html">
<meta property="og:site_name" content="Fly542 技术沉淀">
<meta property="og:description" content="DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION (域名 - 实施和规范) 1. STATUS OF THIS MEMO(此备忘录的状态)This RFC describes the details of the domain system and protocol, and assumes that the reader is familiar wi">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-08-10T02:44:20.000Z">
<meta property="article:modified_time" content="2025-01-02T02:28:26.628Z">
<meta property="article:author" content="Fly542">
<meta property="article:tag" content="dns">
<meta name="twitter:card" content="summary_large_image">
  
  
  <title>RFC1035(域名 - 实施和规范) - Fly542 技术沉淀</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4/github-markdown.min.css" />
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hint.css@2/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.css" />
  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"fly542.cn","root":"/","version":"1.8.14","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 6.0.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Fly542 技术沉淀</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="RFC1035(域名 - 实施和规范)">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2023-08-10 10:44" pubdate>
        2023年8月10日 上午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      76k 字
    </span>
  

  
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      637 分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">RFC1035(域名 - 实施和规范)</h1>
            
            <div class="markdown-body">
              <p>DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION (域名 - 实施和规范)</p>
<h1 id="1-STATUS-OF-THIS-MEMO-此备忘录的状态"><a href="#1-STATUS-OF-THIS-MEMO-此备忘录的状态" class="headerlink" title="1. STATUS OF THIS MEMO(此备忘录的状态)"></a>1. STATUS OF THIS MEMO(此备忘录的状态)</h1><p>This RFC describes the details of the domain system and protocol, and assumes that the reader is familiar with the concepts discussed in a companion RFC, “Domain Names - Concepts and Facilities” [RFC-1034].</p>
<p><em>本 RFC 描述了域系统和协议的详细信息，并假设读者熟悉配套 RFC中所讨论的概念.<a href="%E5%9F%9F%E5%90%8D-%E6%A6%82%E5%BF%B5%E5%92%8C%E8%AE%BE%E6%96%BD">RFC1034</a>.</em></p>
<p>The domain system is a mixture of functions and data types which are an official protocol and functions and data types which are still experimental.  Since the domain system is intentionally extensible, new data types and experimental behavior should always be expected in parts of the system beyond the official protocol.  The official protocol parts include standard queries, responses and the Internet class RR data formats (e.g., host addresses).  Since the previous RFC set, several definitions have changed, so some previous definitions are obsolete.</p>
<p>Experimental or obsolete features are clearly marked in these RFCs, and such information should be used with caution.</p>
<p>The reader is especially cautioned not to depend on the values which appear in examples to be current or complete, since their purpose is primarily pedagogical.  Distribution of this memo is unlimited.</p>
<h1 id="2-INTRODUCTION"><a href="#2-INTRODUCTION" class="headerlink" title="2. INTRODUCTION"></a>2. INTRODUCTION</h1><h2 id="2-1-Overview"><a href="#2-1-Overview" class="headerlink" title="2.1. Overview"></a>2.1. Overview</h2><p>The goal of domain names is to provide a mechanism for naming resources in such a way that the names are usable in different hosts, networks, protocol families, internets, and administrative organizations.</p>
<p>From the user’s point of view, domain names are useful as arguments to a local agent, called a resolver, which retrieves information associated with the domain name.  Thus a user might ask for the host address or mail information associated with a particular domain name.  To enable the user to request a particular type of information, an appropriate query type is passed to the resolver with the domain name.  To the user, the domain tree is a single information space; the resolver is responsible for hiding the distribution of data among name servers from the user.</p>
<p>From the resolver’s point of view, the database that makes up the domain space is distributed among various name servers.  Different parts of the domain space are stored in different name servers, although a particular data item will be stored redundantly in two or more name servers.  The resolver starts with knowledge of at least one name server.  When the resolver processes a user query it asks a known name server for the information; in return, the resolver either receives the desired information or a referral to another name server.  Using these referrals, resolvers learn the identities and contents of other name servers.  Resolvers are responsible for dealing with the distribution of the domain space and dealing with the effects of name server failure by consulting redundant databases in other servers.</p>
<p>Name servers manage two kinds of data.  The first kind of data held in sets called zones; each zone is the complete database for a particular<br>“pruned” subtree of the domain space.  This data is called authoritative.  A name server periodically checks to make sure that its zones are up to date, and if not, obtains a new copy of updated zones from master files stored locally or in another name server.  The second kind of data is cached data which was acquired by a local resolver. This data may be incomplete, but improves the performance of the retrieval process when non-local data is repeatedly accessed.  Cached data is eventually discarded by a timeout mechanism.</p>
<p>This functional structure isolates the problems of user interface, failure recovery, and distribution in the resolvers and isolates the database update and refresh problems in the name servers.</p>
<h2 id="2-2-Common-configurations"><a href="#2-2-Common-configurations" class="headerlink" title="2.2. Common configurations"></a>2.2. Common configurations</h2><p>A host can participate in the domain name system in a number of ways, depending on whether the host runs programs that retrieve information<br>from the domain system, name servers that answer queries from other hosts, or various combinations of both functions.  The simplest, and perhaps most typical, configuration is shown below:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><div class="code-wrapper"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></div></td><td class="code"><pre><code class="hljs gherkin">             Local Host                        |<span class="hljs-string">  Foreign</span><br><span class="hljs-string">                                               </span>|<br>+---------+               +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> user queries  </span>|<span class="hljs-string">          </span>|<span class="hljs-string">queries  </span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">  User   </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string">          </span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string"> Program </span>|<span class="hljs-string">               </span>|<span class="hljs-string"> Resolver </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">  Name  </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">&lt;--------------</span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string"> Server </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string"> user responses</span>|<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>+---------+               +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string">                            </span>|<span class="hljs-string">     A            </span>|<br>            cache additions |<span class="hljs-string">     </span>|<span class="hljs-string"> references </span>|<br>                            V     |<span class="hljs-string">            </span>|<br>                          +----------+         |<span class="hljs-string"></span><br><span class="hljs-string">                          </span>|<span class="hljs-string">  cache   </span>|<span class="hljs-string">         </span>|<br>                          +----------+         |<br></code></pre></td></tr></table></figure>
<p>User programs interact with the domain name space through resolvers; the  format of user queries and user responses is specific to the host and its operating system.  User queries will typically be operating system calls, and the resolver and its cache will be part of the host operating system.  Less capable hosts may choose to implement the resolver as a subroutine to be linked in with every program that needs its services. Resolvers answer user queries with information they acquire via queries to foreign name servers and the local cache.</p>
<p>Note that the resolver may have to make several queries to several different foreign name servers to answer a particular user query, and hence the resolution of a user query may involve several network accesses and an arbitrary amount of time.  The queries to foreign name servers and the corresponding responses have a standard format described</p>
<p>in this memo, and may be datagrams.</p>
<p>Depending on its capabilities, a name server could be a stand alone program on a dedicated machine or a process or processes on a large timeshared host.  A simple configuration might be:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">             Local Host                        |<span class="hljs-string">  Foreign</span><br><span class="hljs-string">                                               </span>|<br>  +---------+                                  |<span class="hljs-string"></span><br><span class="hljs-string"> /         /</span>|<span class="hljs-string">                                  </span>|<br>+---------+ |<span class="hljs-string">             +----------+         </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">   Name   </span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string">  Master </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string">  Server  </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">Resolver</span>|<br>|<span class="hljs-string">  files  </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">/              </span>|<span class="hljs-string">          </span>|<span class="hljs-string"> queries </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string">+---------+               +----------+         </span>|<br></code></pre></td></tr></table></figure>
<p>Here a primary name server acquires information about one or more zones by reading master files from its local file system, and answers queries about those zones that arrive from foreign resolvers.</p>
<p>The DNS requires that all zones be redundantly supported by more than one name server.  Designated secondary servers can acquire zones and check for updates from the primary server using the zone transfer protocol of the DNS. This configuration is shown below:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">             Local Host                        |<span class="hljs-string">  Foreign</span><br><span class="hljs-string">                                               </span>|<br>  +---------+                                  |<span class="hljs-string"></span><br><span class="hljs-string"> /         /</span>|<span class="hljs-string">                                  </span>|<br>+---------+ |<span class="hljs-string">             +----------+         </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">   Name   </span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string">  Master </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string">  Server  </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">Resolver</span>|<br>|<span class="hljs-string">  files  </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">/              </span>|<span class="hljs-string">          </span>|<span class="hljs-string"> queries </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string">+---------+               +----------+         </span>|<br>                            A     |<span class="hljs-string">maintenance </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string">                            </span>|<span class="hljs-string">     +------------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">        </span>|<br>                            |<span class="hljs-string">      queries     </span>|<span class="hljs-string">  </span>|<span class="hljs-string">Foreign </span>|<br>                            |<span class="hljs-string">                  </span>|<span class="hljs-string">  </span>|<span class="hljs-string">  Name  </span>|<br>                            +------------------|<span class="hljs-string">--</span>|<span class="hljs-string"> Server </span>|<br>                         maintenance responses |<span class="hljs-string">  +--------+</span><br></code></pre></td></tr></table></figure>
<p>In this configuration, the name server periodically establishes a virtual circuit to a foreign name server to acquire a copy of a zone or to check that an existing copy has not changed.  The messages sent for these maintenance activities follow the same form as queries and responses, but the message sequences are somewhat different.</p>
<p>The information flow in a host that supports all aspects of the domain name system is shown below:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">             Local Host                        |<span class="hljs-string">  Foreign</span><br><span class="hljs-string">                                               </span>|<br>+---------+               +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> user queries  </span>|<span class="hljs-string">          </span>|<span class="hljs-string">queries  </span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">  User   </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string">          </span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string"> Program </span>|<span class="hljs-string">               </span>|<span class="hljs-string"> Resolver </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">  Name  </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">&lt;--------------</span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string"> Server </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string"> user responses</span>|<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>+---------+               +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string">                            </span>|<span class="hljs-string">     A            </span>|<br>            cache additions |<span class="hljs-string">     </span>|<span class="hljs-string"> references </span>|<br>                            V     |<span class="hljs-string">            </span>|<br>                          +----------+         |<span class="hljs-string"></span><br><span class="hljs-string">                          </span>|<span class="hljs-string">  Shared  </span>|<span class="hljs-string">         </span>|<br>                          |<span class="hljs-string"> database </span>|<span class="hljs-string">         </span>|<br>                          +----------+         |<span class="hljs-string"></span><br><span class="hljs-string">                            A     </span>|<span class="hljs-string">            </span>|<br>  +---------+     refreshes |<span class="hljs-string">     </span>|<span class="hljs-string"> references </span>|<br> /         /|<span class="hljs-string">               </span>|<span class="hljs-string">     V            </span>|<br>+---------+ |<span class="hljs-string">             +----------+         </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">   Name   </span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string">  Master </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string">  Server  </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">Resolver</span>|<br>|<span class="hljs-string">  files  </span>|<span class="hljs-string"> </span>|<span class="hljs-string">             </span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">/              </span>|<span class="hljs-string">          </span>|<span class="hljs-string"> queries </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string">+---------+               +----------+         </span>|<br>                            A     |<span class="hljs-string">maintenance </span>|<span class="hljs-string">  +--------+</span><br><span class="hljs-string">                            </span>|<span class="hljs-string">     +------------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">        </span>|<br>                            |<span class="hljs-string">      queries     </span>|<span class="hljs-string">  </span>|<span class="hljs-string">Foreign </span>|<br>                            |<span class="hljs-string">                  </span>|<span class="hljs-string">  </span>|<span class="hljs-string">  Name  </span>|<br>                            +------------------|<span class="hljs-string">--</span>|<span class="hljs-string"> Server </span>|<br>                         maintenance responses |<span class="hljs-string">  +--------+</span><br></code></pre></td></tr></table></figure>
<p>The shared database holds domain space data for the local name server and resolver.  The contents of the shared database will typically be a mixture of authoritative data maintained by the periodic refresh operations of the name server and cached data from previous resolver requests.  The structure of the domain data and the necessity for synchronization between name servers and resolvers imply the general characteristics of this database, but the actual format is up to the local implementor.</p>
<p>Information flow can also be tailored so that a group of hosts act together to optimize activities.  Sometimes this is done to offload less capable hosts so that they do not have to implement a full resolver. This can be appropriate for PCs or hosts which want to minimize the amount of new network code which is required.  This scheme can also allow a group of hosts can share a small number of caches rather than maintaining a large number of separate caches, on the premise that the centralized caches will have a higher hit ratio.  In either case, resolvers are replaced with stub resolvers which act as front ends to resolvers located in a recursive server in one or more name servers known to perform that service:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">               Local Hosts                     |<span class="hljs-string">  Foreign</span><br><span class="hljs-string">                                               </span>|<br>+---------+                                    |<span class="hljs-string"></span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> responses                          </span>|<br>|<span class="hljs-string"> Stub    </span>|<span class="hljs-string">&lt;--------------------+              </span>|<br>|<span class="hljs-string"> Resolver</span>|<span class="hljs-string">                     </span>|<span class="hljs-string">              </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">----------------+    </span>|<span class="hljs-string">              </span>|<br>+---------+ recursive      |<span class="hljs-string">    </span>|<span class="hljs-string">              </span>|<br>            queries        |<span class="hljs-string">    </span>|<span class="hljs-string">              </span>|<br>                           V    |<span class="hljs-string">              </span>|<br>+---------+ recursive     +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string"></span>|<span class="hljs-string">         </span>|<span class="hljs-string"> queries       </span>|<span class="hljs-string">          </span>|<span class="hljs-string">queries  </span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>|<span class="hljs-string"> Stub    </span>|<span class="hljs-string">--------------&gt;</span>|<span class="hljs-string"> Recursive</span>|<span class="hljs-string">---------</span>|<span class="hljs-string">-&gt;</span>|<span class="hljs-string">Foreign </span>|<br>|<span class="hljs-string"> Resolver</span>|<span class="hljs-string">               </span>|<span class="hljs-string"> Server   </span>|<span class="hljs-string">         </span>|<span class="hljs-string">  </span>|<span class="hljs-string">  Name  </span>|<br>|<span class="hljs-string">         </span>|<span class="hljs-string">&lt;--------------</span>|<span class="hljs-string">          </span>|<span class="hljs-string">&lt;--------</span>|<span class="hljs-string">--</span>|<span class="hljs-string"> Server </span>|<br>+---------+ responses     |<span class="hljs-string">          </span>|<span class="hljs-string">responses</span>|<span class="hljs-string">  </span>|<span class="hljs-string">        </span>|<br>                          +----------+         |<span class="hljs-string">  +--------+</span><br><span class="hljs-string">                          </span>|<span class="hljs-string">  Central </span>|<span class="hljs-string">         </span>|<br>                          |<span class="hljs-string">   cache  </span>|<span class="hljs-string">         </span>|<br>                          +----------+         |<br></code></pre></td></tr></table></figure>
<p>In any case, note that domain components are always replicated for reliability whenever possible.</p>
<h2 id="2-3-Conventions"><a href="#2-3-Conventions" class="headerlink" title="2.3. Conventions"></a>2.3. Conventions</h2><p>The domain system has several conventions dealing with low-level, but fundamental, issues.  While the implementor is free to violate these conventions WITHIN HIS OWN SYSTEM, he must observe these conventions in ALL behavior observed from other hosts.</p>
<h3 id="2-3-1-Preferred-name-syntax"><a href="#2-3-1-Preferred-name-syntax" class="headerlink" title="2.3.1. Preferred name syntax"></a>2.3.1. Preferred name syntax</h3><p>The DNS specifications attempt to be as general as possible in the rules for constructing domain names.  The idea is that the name of any existing object can be expressed as a domain name with minimal changes.</p>
<p>However, when assigning a domain name for an object, the prudent user will select a name which satisfies both the rules of the domain system and any existing rules for the object, whether these rules are published or implied by existing programs.</p>
<p>For example, when naming a mail domain, the user should satisfy both the rules of this memo and those in RFC-822.  When creating a new host name, the old rules for HOSTS.TXT should be followed.  This avoids problems when old software is converted to use domain names.</p>
<p>The following syntax will result in fewer problems with many applications that use domain names (e.g., mail, TELNET).</p>
<figure class="highlight bnf"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><code class="hljs bnf"><span class="hljs-attribute">&lt;domain&gt;</span> ::= &lt;subdomain&gt; | <span class="hljs-string">&quot; &quot;</span><br><br><span class="hljs-attribute">&lt;subdomain&gt;</span> ::= &lt;label&gt; | &lt;subdomain&gt; <span class="hljs-string">&quot;.&quot;</span> &lt;label&gt;<br><br><span class="hljs-attribute">&lt;label&gt;</span> ::= &lt;letter&gt; [ [ &lt;ldh-str&gt; ] &lt;let-dig&gt; ]<br><br><span class="hljs-attribute">&lt;ldh-str&gt;</span> ::= &lt;let-dig-hyp&gt; | &lt;let-dig-hyp&gt; &lt;ldh-str&gt;<br><br><span class="hljs-attribute">&lt;let-dig-hyp&gt;</span> ::= &lt;let-dig&gt; | <span class="hljs-string">&quot;-&quot;</span><br><br><span class="hljs-attribute">&lt;let-dig&gt;</span> ::= &lt;letter&gt; | &lt;digit&gt;<br><br><span class="hljs-attribute">&lt;letter&gt;</span> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case<br><br><span class="hljs-attribute">&lt;digit&gt;</span> ::= any one of the ten digits 0 through 9<br></code></pre></td></tr></table></figure>
<p>Note that while upper and lower case letters are allowed in domain names, no significance is attached to the case.  That is, two names with the same spelling but different case are to be treated as if identical.</p>
<p>The labels must follow the rules for ARPANET host names.  They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen.  There are also some restrictions on the length.  Labels must be 63 characters or less.</p>
<p>For example, the following strings identify hosts in the Internet:</p>
<p>A.ISI.EDU XX.LCS.MIT.EDU SRI-NIC.ARPA</p>
<h3 id="2-3-2-Data-Transmission-Order"><a href="#2-3-2-Data-Transmission-Order" class="headerlink" title="2.3.2. Data Transmission Order"></a>2.3.2. Data Transmission Order</h3><p>The order of transmission of the header and data described in this document is resolved to the octet level.  Whenever a diagram shows a</p>
<p>group of octets, the order of transmission of those octets is the normal order in which they are read in English.  For example, in the following diagram, the octets are transmitted in the order they are numbered.</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code"> 0                   1</span><br><span class="hljs-section"> 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</span><br><span class="hljs-section">|       1       |       2       |</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</span><br><span class="hljs-section">|       3       |       4       |</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</span><br><span class="hljs-section">|       5       |       6       |</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</span><br></code></pre></td></tr></table></figure>
<p>Whenever an octet represents a numeric quantity, the left most bit in the diagram is the high order or most significant bit.  That is, the bit labeled 0 is the most significant bit.  For example, the following diagram represents the value 170 (decimal).</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-section"> 0 1 2 3 4 5 6 7</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+</span><br><span class="hljs-section">|1 0 1 0 1 0 1 0|</span><br><span class="hljs-section">+-+-+-+-+-+-+-+-+</span><br></code></pre></td></tr></table></figure>
<p>Similarly, whenever a multi-octet field represents a numeric quantity the left most bit of the whole field is the most significant bit.  When a multi-octet quantity is transmitted the most significant octet is transmitted first.</p>
<p>2.3.3. Character Case</p>
<p>For all parts of the DNS that are part of the official protocol, all comparisons between character strings (e.g., labels, domain names, etc.) are done in a case-insensitive manner.  At present, this rule is in force throughout the domain system without exception.  However, future additions beyond current usage may need to use the full binary octet capabilities in names, so attempts to store domain names in 7-bit ASCII or use of special bytes to terminate labels, etc., should be avoided.</p>
<p>When data enters the domain system, its original case should be preserved whenever possible.  In certain circumstances this cannot be done.  For example, if two RRs are stored in a database, one at x.y and one at X.Y, they are actually stored at the same place in the database, and hence only one casing would be preserved.  The basic rule is that case can be discarded only when data is used to define structure in a database, and two names are identical when compared in a case insensitive manner.</p>
<p>Loss of case sensitive data must be minimized.  Thus while data for x.y and X.Y may both be stored under a single location x.y or X.Y, data for a.x and B.X would never be stored under A.x, A.X, b.x, or b.X.  In general, this preserves the case of the first label of a domain name, but forces standardization of interior node labels.</p>
<p>Systems administrators who enter data into the domain database should take care to represent the data they supply to the domain system in a case-consistent manner if their system is case-sensitive.  The data distribution system in the domain system will ensure that consistent representations are preserved.</p>
<h3 id="2-3-4-Size-limits"><a href="#2-3-4-Size-limits" class="headerlink" title="2.3.4.  Size limits"></a>2.3.4.  Size limits</h3><p>Various objects and parameters in the DNS have size limits.  They are listed below.  Some could be easily changed, others are more fundamental.</p>
<p>labels          63 octets or less </p>
<p>names           255 octets or less </p>
<p>TTL             positive values of a signed 32 bit number.  </p>
<p>UDP messages    512 octets or less  </p>
<h1 id="3-DOMAIN-NAME-SPACE-AND-RR-DEFINITIONS"><a href="#3-DOMAIN-NAME-SPACE-AND-RR-DEFINITIONS" class="headerlink" title="3.  DOMAIN NAME SPACE AND RR DEFINITIONS"></a>3.  DOMAIN NAME SPACE AND RR DEFINITIONS</h1><h2 id="3-1-Name-space-definitions"><a href="#3-1-Name-space-definitions" class="headerlink" title="3.1.   Name space definitions"></a>3.1.   Name space definitions</h2><p>Domain names in messages are expressed in terms of a sequence of labels. Each label is represented as a one octet length field followed by that number of octets.  Since every domain name ends with the null label of the root, a domain name is terminated by a length byte of zero.  The high order two bits of every length octet must be zero, and the remaining six bits of the length field limit the label to 63 octets or less.</p>
<p>To simplify implementations, the total length of a domain name (i.e., label octets and label length octets) is restricted to 255 octets or less.</p>
<p>Although labels can contain any 8 bit values in octets that make up a label, it is strongly recommended that labels follow the preferred syntax described elsewhere in this memo, which is compatible with existing host naming conventions.  Name servers and resolvers must compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII with zero parity.  Non-alphabetic codes must match exactly.</p>
<h2 id="3-2-RR-definitions"><a href="#3-2-RR-definitions" class="headerlink" title="3.2.  RR definitions"></a>3.2.  RR definitions</h2><h3 id="3-2-1-Format"><a href="#3-2-1-Format" class="headerlink" title="3.2.1. Format"></a>3.2.1. Format</h3><p>All RRs have the same top level format shown below:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">                                1  1  1  1  1  1</span><br><span class="hljs-section">  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                                               |<br>/                                               /<br>/                      NAME                     /<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                      TYPE                     |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                     CLASS                     |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                      TTL                      |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                   RDLENGTH                    |<br><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--|<br>/                     RDATA                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>NAME             an owner name, i.e., the name of the node to which this resource record pertains.</p>
<p>TYPE             two octets containing one of the RR TYPE codes.</p>
<p>CLASS           two octets containing one of the RR CLASS codes.</p>
<p>TTL             a 32 bit signed integer that specifies the time interval that the resource record may be cached before the source of the information should again be consulted.  Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached.  For example, SOA records are always distributed with a zero TTL to prohibit caching.  Zero values can also be used for extremely volatile data.</p>
<p>RDLENGTH        an unsigned 16 bit integer that specifies the length in octets of the RDATA field.</p>
<p>RDATA           a variable length string of octets that describes the resource.  The format of this information varies according to the TYPE and CLASS of the resource record.</p>
<h3 id="3-2-2-TYPE-values"><a href="#3-2-2-TYPE-values" class="headerlink" title="3.2.2.  TYPE values"></a>3.2.2.  TYPE values</h3><p>TYPE fields are used in resource records.  Note that these types are a subset of QTYPEs.</p>
<p>TYPE            value and meaning</p>
<p>A               1 a host address</p>
<p>NS              2 an authoritative name server</p>
<p>MD              3 a mail destination (Obsolete - use MX)</p>
<p>MF              4 a mail forwarder (Obsolete - use MX)</p>
<p>CNAME           5 the canonical name for an alias</p>
<p>SOA             6 marks the start of a zone of authority</p>
<p>MB              7 a mailbox domain name (EXPERIMENTAL)</p>
<p>MG              8 a mail group member (EXPERIMENTAL)</p>
<p>MR              9 a mail rename domain name (EXPERIMENTAL)</p>
<p>NULL            10 a null RR (EXPERIMENTAL)</p>
<p>WKS             11 a well known service description</p>
<p>PTR             12 a domain name pointer</p>
<p>HINFO           13 host information</p>
<p>MINFO           14 mailbox or mail list information</p>
<p>MX              15 mail exchange</p>
<p>TXT             16 text strings</p>
<h3 id="3-2-3-QTYPE-values"><a href="#3-2-3-QTYPE-values" class="headerlink" title="3.2.3. QTYPE values"></a>3.2.3. QTYPE values</h3><p>QTYPE fields appear in the question part of a query.  QTYPES are a superset of TYPEs, hence all TYPEs are valid QTYPEs.  In addition, the following QTYPEs are defined:</p>
<p>AXFR            252 A request for a transfer of an entire zone</p>
<p>MAILB           253 A request for mailbox-related records (MB, MG or MR)</p>
<p>MAILA           254 A request for mail agent RRs (Obsolete - see MX)</p>
<ul>
<li><div class="code-wrapper"><pre><code class="hljs">          255 A request for all records
</code></pre></div>
</li>
</ul>
<h3 id="3-2-4-CLASS-values"><a href="#3-2-4-CLASS-values" class="headerlink" title="3.2.4. CLASS values"></a>3.2.4. CLASS values</h3><p>CLASS fields appear in resource records.  The following CLASS mnemonics<br>and values are defined:</p>
<p>IN              1 the Internet</p>
<p>CS              2 the CSNET class (Obsolete - used only for examples in some obsolete RFCs)</p>
<p>CH              3 the CHAOS class</p>
<p>HS              4 Hesiod [Dyer 87]</p>
<h3 id="3-2-5-QCLASS-values"><a href="#3-2-5-QCLASS-values" class="headerlink" title="3.2.5. QCLASS values"></a>3.2.5. QCLASS values</h3><p>QCLASS fields appear in the question section of a query.  QCLASS values are a superset of CLASS values; every CLASS is a valid QCLASS.  In addition to CLASS values, the following QCLASSes are defined:</p>
<ul>
<li><div class="code-wrapper"><pre><code class="hljs">          255 any class
</code></pre></div>
</li>
</ul>
<h2 id="3-3-Standard-RRs-标准-RR"><a href="#3-3-Standard-RRs-标准-RR" class="headerlink" title="3.3. Standard RRs(标准 RR)"></a>3.3. Standard RRs(标准 RR)</h2><p>The following RR definitions are expected to occur, at least potentially, in all classes.  In particular, NS, SOA, CNAME, and PTR will be used in all classes, and have the same format in all classes. Because their RDATA format is known, all domain names in the RDATA section of these RRs may be compressed.</p>
<p><domain-name> is a domain name represented as a series of labels, and terminated by a label with zero length.  <character-string> is a single length octet followed by that number of characters.  <character-string> is treated as binary information, and can be up to 256 characters in length (including the length octet).</p>
<h3 id="3-3-1-CNAME-RDATA-format"><a href="#3-3-1-CNAME-RDATA-format" class="headerlink" title="3.3.1. CNAME RDATA format"></a>3.3.1. CNAME RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                     CNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>CNAME           A <domain-name> which specifies the canonical or primary name for the owner.  The owner name is an alias.</p>
<p>CNAME RRs cause no additional section processing, but name servers may choose to restart the query at the canonical name in certain cases.  See the description of name server logic in [RFC-1034] for details.</p>
<h3 id="3-3-2-HINFO-RDATA-format"><a href="#3-3-2-HINFO-RDATA-format" class="headerlink" title="3.3.2. HINFO RDATA format"></a>3.3.2. HINFO RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">/                      CPU                      /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">/                       OS                      /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>CPU             A <character-string> which specifies the CPU type.</p>
<p>OS              A <character-string> which specifies the operating<br>                system type.</p>
<p>Standard values for CPU and OS can be found in [RFC-1010].</p>
<p>HINFO records are used to acquire general information about a host.  The main use is for protocols such as FTP that can use special procedures when talking between machines or operating systems of the same type.</p>
<h3 id="3-3-3-MB-RDATA-format-EXPERIMENTAL"><a href="#3-3-3-MB-RDATA-format-EXPERIMENTAL" class="headerlink" title="3.3.3. MB RDATA format (EXPERIMENTAL)"></a>3.3.3. MB RDATA format (EXPERIMENTAL)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   MADNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>MADNAME         A <domain-name> which specifies a host which has the specified mailbox.</p>
<p>MB records cause additional section processing which looks up an A type RRs corresponding to MADNAME.</p>
<h3 id="3-3-4-MD-RDATA-format-Obsolete"><a href="#3-3-4-MD-RDATA-format-Obsolete" class="headerlink" title="3.3.4. MD RDATA format (Obsolete)"></a>3.3.4. MD RDATA format (Obsolete)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   MADNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>MADNAME         A <domain-name> which specifies a host which has a mail agent for the domain which should be able to deliver mail for the domain.</p>
<p>MD records cause additional section processing which looks up an A type record corresponding to MADNAME.</p>
<p>MD is obsolete.  See the definition of MX and [RFC-974] for details of the new scheme.  The recommended policy for dealing with MD RRs found in a master file is to reject them, or to convert them to MX RRs with a preference of 0.</p>
<h3 id="3-3-5-MF-RDATA-format-Obsolete"><a href="#3-3-5-MF-RDATA-format-Obsolete" class="headerlink" title="3.3.5. MF RDATA format (Obsolete)"></a>3.3.5. MF RDATA format (Obsolete)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   MADNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>MADNAME         A <domain-name> which specifies a host which has a mail agent for the domain which will accept mail for forwarding to the domain.</p>
<p>MF records cause additional section processing which looks up an A type record corresponding to MADNAME.</p>
<p>MF is obsolete.  See the definition of MX and [RFC-974] for details ofw the new scheme.  The recommended policy for dealing with MD RRs found in a master file is to reject them, or to convert them to MX RRs with a preference of 10.</p>
<h3 id="3-3-6-MG-RDATA-format-EXPERIMENTAL"><a href="#3-3-6-MG-RDATA-format-EXPERIMENTAL" class="headerlink" title="3.3.6. MG RDATA format (EXPERIMENTAL)"></a>3.3.6. MG RDATA format (EXPERIMENTAL)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   MGMNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>MGMNAME         A <domain-name> which specifies a mailbox which is a member of the mail group specified by the domain name.</p>
<p>MG records cause no additional section processing.</p>
<h3 id="3-3-7-MINFO-RDATA-format-EXPERIMENTAL"><a href="#3-3-7-MINFO-RDATA-format-EXPERIMENTAL" class="headerlink" title="3.3.7. MINFO RDATA format (EXPERIMENTAL)"></a>3.3.7. MINFO RDATA format (EXPERIMENTAL)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">/                    RMAILBX                    /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">/                    EMAILBX                    /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>RMAILBX         A <domain-name> which specifies a mailbox which is responsible for the mailing list or mailbox.  If this domain name names the root, the owner of the MINFO RR is responsible for itself.  Note that many existing mailing lists use a mailbox X-request for the RMAILBX field of mailing list X, e.g., Msgroup-request for Msgroup.  This field provides a more general mechanism.</p>
<p>EMAILBX         A <domain-name> which specifies a mailbox which is to receive error messages related to the mailing list or mailbox specified by the owner of the MINFO RR (similar to the ERRORS-TO: field which has been proposed).  If this domain name names the root, errors should be returned to the sender of the message.</p>
<p>MINFO records cause no additional section processing.  Although these records can be associated with a simple mailbox, they are usually used with a mailing list.</p>
<p>3.3.8. MR RDATA format (EXPERIMENTAL)</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   NEWNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>NEWNAME         A <domain-name> which specifies a mailbox which is the proper rename of the specified mailbox.</p>
<p>MR records cause no additional section processing.  The main use for MR is as a forwarding entry for a user who has moved to a different mailbox.</p>
<h3 id="3-3-9-MX-RDATA-format"><a href="#3-3-9-MX-RDATA-format" class="headerlink" title="3.3.9. MX RDATA format"></a>3.3.9. MX RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">|                  PREFERENCE                   |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>/                   EXCHANGE                    /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>PREFERENCE      A 16 bit integer which specifies the preference given to this RR among others at the same owner.  Lower values are preferred.</p>
<p>EXCHANGE        A <domain-name> which specifies a host willing to act as a mail exchange for the owner name.</p>
<p>MX records cause type A additional section processing for the host specified by EXCHANGE.  The use of MX RRs is explained in detail in [RFC-974].</p>
<h3 id="3-3-10-NULL-RDATA-format-EXPERIMENTAL"><a href="#3-3-10-NULL-RDATA-format-EXPERIMENTAL" class="headerlink" title="3.3.10. NULL RDATA format (EXPERIMENTAL)"></a>3.3.10. NULL RDATA format (EXPERIMENTAL)</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                  &lt;anything&gt;                   /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>Anything at all may be in the RDATA field so long as it is 65535 octets or less.</p>
<p>NULL records cause no additional section processing.  NULL RRs are not allowed in master files.  NULLs are used as placeholders in some experimental extensions of the DNS.</p>
<h3 id="3-3-11-NS-RDATA-format"><a href="#3-3-11-NS-RDATA-format" class="headerlink" title="3.3.11. NS RDATA format"></a>3.3.11. NS RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                   NSDNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>NSDNAME         A <domain-name> which specifies a host which should be authoritative for the specified class and domain.</p>
<p>NS records cause both the usual additional section processing to locate a type A record, and, when used in a referral, a special search of the zone in which they reside for glue information.</p>
<p>The NS RR states that the named host should be expected to have a zone starting at owner name of the specified class.  Note that the class may not indicate the protocol family which should be used to communicate with the host, although it is typically a strong hint.  For example, hosts which are name servers for either Internet (IN) or Hesiod (HS) class information are normally queried using IN class protocols.</p>
<h3 id="3-3-12-PTR-RDATA-format"><a href="#3-3-12-PTR-RDATA-format" class="headerlink" title="3.3.12. PTR RDATA format"></a>3.3.12. PTR RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">/                   PTRDNAME                    /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>PTRDNAME        A <domain-name> which points to some location in the domain name space.</p>
<p>PTR records cause no additional section processing.  These RRs are used in special domains to point to some other location in the domain space. These records are simple data, and don’t imply any special processing similar to that performed by CNAME, which identifies aliases.  See the description of the IN-ADDR.ARPA domain for an example.</p>
<h3 id="3-3-13-SOA-RDATA-format"><a href="#3-3-13-SOA-RDATA-format" class="headerlink" title="3.3.13. SOA RDATA format"></a>3.3.13. SOA RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br>/                     MNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">/                     RNAME                     /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                    SERIAL                     |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                    REFRESH                    |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                     RETRY                     |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                    EXPIRE                     |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                    MINIMUM                    |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>MNAME           The <domain-name> of the name server that was the original or primary source of data for this zone.<br>                <em>作为该区域的原始或主要数据源的名称服务器的&lt;域名&gt; 。</em></p>
<p>RNAME           A <domain-name> which specifies the mailbox of the person responsible for this zone.<br>                <em>指定负责此区域的人员的邮箱的&lt;域名&gt;。</em></p>
<p>SERIAL          The unsigned 32 bit version number of the original copy of the zone.  Zone transfers preserve this value.  This value wraps and should be compared using sequence space arithmetic.<br>                <em>无符号32位标识的区域原始副本的版本号。 区域传输保留该值。 该值会回绕并应使用序列空间算术进行比较。</em></p>
<p>REFRESH         A 32 bit time interval before the zone should be refreshed.<br>                <em>32位标识的该区域刷新时间间隔。</em></p>
<p>RETRY           A 32 bit time interval that should elapse before a failed refresh should be retried.<br>                <em>32位标识的重试失败前刷新时间间隔</em></p>
<p>EXPIRE          A 32 bit time value that specifies the upper limit on the time interval that can elapse before the zone is no longer authoritative.<br>                <em>32位标识的 指定区域不再具有权威之前可以经过的时间间隔上限。</em></p>
<p>MINIMUM         The unsigned 32 bit minimum TTL field that should be exported with any RR from this zone.<br>                <em>无符号32位标识的与此区域中的任何RR一起导出的最小TTL字段。</em></p>
<p>SOA records cause no additional section processing.<br><em>SOA记录不会导致任何其他节处理。</em></p>
<p>All times are in units of seconds.<br><em>所有时间均以秒为单位。</em></p>
<p>Most of these fields are pertinent only for name server maintenance operations.  However, MINIMUM is used in all query operations that retrieve RRs from a zone.  Whenever a RR is sent in a response to a query, the TTL field is set to the maximum of the TTL field from the RR and the MINIMUM field in the appropriate SOA.  Thus MINIMUM is a lower bound on the TTL field for all RRs in a zone.  Note that this use of MINIMUM should occur when the RRs are copied into the response and not when the zone is loaded from a master file or via a zone transfer.  The reason for this provison is to allow future dynamic update facilities to change the SOA RR with known semantics.<br><em>这些字段中的大部分仅与名称服务器的维护操作相关。然而，MINIMUM在从一个区域检索RR的所有查询操作中都会被用到。每当一个RR被发送到一个查询的回复中，TTL字段将被设定为RR的TTL字段和适当SOA中的MINIMUM字段的最大值。因此，MINIMUM是一个区域中所有RR的TTL字段的下限。注意，这种对MINIMUM的使用应该在RR被复制到回应中时发生，而不是当区域从主文件或通过区域传输加载时。这个规定的原因是为了允许未来的动态更新设施改变SOA RR，以便有已知的语义。</em></p>
<h3 id="3-3-14-TXT-RDATA-format"><a href="#3-3-14-TXT-RDATA-format" class="headerlink" title="3.3.14. TXT RDATA format"></a>3.3.14. TXT RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">/                   TXT-DATA                    /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>TXT-DATA        One or more <character-string>s.</p>
<p>TXT RRs are used to hold descriptive text.  The semantics of the text depends on the domain where it is found.</p>
<h2 id="3-4-Internet-specific-RRs-互联网特定的-RR"><a href="#3-4-Internet-specific-RRs-互联网特定的-RR" class="headerlink" title="3.4. Internet specific RRs(互联网特定的 RR)"></a>3.4. Internet specific RRs(互联网特定的 RR)</h2><h3 id="3-4-1-A-RDATA-format"><a href="#3-4-1-A-RDATA-format" class="headerlink" title="3.4.1. A RDATA format"></a>3.4.1. A RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">|                    ADDRESS                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>ADDRESS         A 32 bit Internet address.</p>
<p>Hosts that have multiple Internet addresses will have multiple A records.</p>
<p>A records cause no additional section processing.  The RDATA section of an A line in a master file is an Internet address expressed as four decimal numbers separated by dots without any imbedded spaces (e.g., “10.2.0.52” or “192.0.5.6”).</p>
<h3 id="3-4-2-WKS-RDATA-format"><a href="#3-4-2-WKS-RDATA-format" class="headerlink" title="3.4.2. WKS RDATA format"></a>3.4.2. WKS RDATA format</h3><figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">|                    ADDRESS                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|       PROTOCOL        |                       |<br><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+                       |<br>|                                               |<br>/                   &lt;BIT MAP&gt;                   /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>ADDRESS         An 32 bit Internet address</p>
<p>PROTOCOL        An 8 bit IP protocol number</p>
<p><BIT MAP>       A variable length bit map.  The bit map must be a multiple of 8 bits long.</p>
<p>The WKS record is used to describe the well known services supported by a particular protocol on a particular internet address.  The PROTOCOL field specifies an IP protocol number, and the bit map has one bit per port of the specified protocol.  The first bit corresponds to port 0, the second to port 1, etc.  If the bit map does not include a bit for a protocol of interest, that bit is assumed zero.  The appropriate values and mnemonics for ports and protocols are specified in [RFC-1010].</p>
<p>For example, if PROTOCOL=TCP (6), the 26th bit corresponds to TCP port 25 (SMTP).  If this bit is set, a SMTP server should be listening on TCP port 25; if zero, SMTP service is not supported on the specified address.</p>
<p>The purpose of WKS RRs is to provide availability information for servers for TCP and UDP.  If a server supports both TCP and UDP, or has multiple Internet addresses, then multiple WKS RRs are used.</p>
<p>WKS RRs cause no additional section processing.</p>
<p>In master files, both ports and protocols are expressed using mnemonics or decimal numbers.</p>
<h2 id="3-5-IN-ADDR-ARPA-domain-IN-ADDR-ARPA-域名"><a href="#3-5-IN-ADDR-ARPA-domain-IN-ADDR-ARPA-域名" class="headerlink" title="3.5. IN-ADDR.ARPA domain(IN-ADDR.ARPA 域名)"></a>3.5. IN-ADDR.ARPA domain(IN-ADDR.ARPA 域名)</h2><p>The Internet uses a special domain to support gateway location and Internet address to host mapping.  Other classes may employ a similar strategy in other domains.  The intent of this domain is to provide a guaranteed method to perform host address to host name mapping, and to facilitate queries to locate all gateways on a particular network in the Internet.<br><em>互联网使用特殊的域来支持网关位置和互联网地址到主机的映射。 其他类可能在其他领域采用类似的策略。 该域的目的是提供一种有保证的方法来执行主机地址到主机名的映射，并方便查询以定位 Internet 中特定网络上的所有网关。</em></p>
<p>Note that both of these services are similar to functions that could be performed by inverse queries; the difference is that this part of the domain name space is structured according to address, and hence can guarantee that the appropriate data can be located without an exhaustive search of the domain space.<br><em>请注意，这两种服务都类似于可以通过反向查询执行的功能； 不同之处在于，这部分域名空间是根据地址构建的，因此可以保证无需穷举搜索域名空间即可找到适当的数据。</em></p>
<p>The domain begins at IN-ADDR.ARPA and has a substructure which follows the Internet addressing structure.<br><em>该域从 IN-ADDR.ARPA 开始，并具有遵循 Internet 寻址结构的子结构。</em></p>
<p>Domain names in the IN-ADDR.ARPA domain are defined to have up to four labels in addition to the IN-ADDR.ARPA suffix.  Each label represents one octet of an Internet address, and is expressed as a character string for a decimal value in the range 0-255 (with leading zeros omitted except in the case of a zero octet which is represented by a single zero).<br><em>IN-ADDR.ARPA 域中的域名定义为除了 IN-ADDR.ARPA 后缀之外最多还有四个标签。 每个标签代表互联网地址的一个八位位组，并表示为 0-255 范围内的十进制值的字符串（除了用单个零表示的零八位位组的情况之外，省略前导零）。</em></p>
<p>Host addresses are represented by domain names that have all four labels specified.  Thus data for Internet address 10.2.0.52 is located at domain name 52.0.2.10.IN-ADDR.ARPA.  The reversal, though awkward to read, allows zones to be delegated which are exactly one network of address space.  For example, 10.IN-ADDR.ARPA can be a zone containing data for the ARPANET, while 26.IN-ADDR.ARPA can be a separate zone for MILNET.  Address nodes are used to hold pointers to primary host names in the normal domain space.<br><em>主机地址由指定了所有四个标签的域名表示。 因此，互联网地址 10.2.0.52 的数据位于域名 52.0.2.10.IN-ADDR.ARPA 处。 这种逆转虽然读起来很困难，但允许对恰好是一个地址空间网络的区域进行委派。 例如，10.IN-ADDR.ARPA 可以是包含 ARPANET 数据的区域，而 26.IN-ADDR.ARPA 可以是 MILNET 的单独区域。 地址节点用于保存指向正常域空间中主主机名的指针。</em></p>
<p>Network numbers correspond to some non-terminal nodes at various depths in the IN-ADDR.ARPA domain, since Internet network numbers are either 1, 2, or 3 octets.  Network nodes are used to hold pointers to the primary host names of gateways attached to that network.  Since a gateway is, by definition, on more than one network, it will typically have two or more network nodes which point at it.  Gateways will also have host level pointers at their fully qualified addresses.<br><em>网络号对应于 IN-ADDR.ARPA 域中不同深度的一些非终端节点，因为互联网网络号是 1、2 或 3 个八位位组。 网络节点用于保存指向连接到该网络的网关的主要主机名的指针。 由于根据定义，网关位于多个网络上，因此它通常有两个或多个指向它的网络节点。 网关还将在其完全限定地址处拥有主机级指针。</em></p>
<p>Both the gateway pointers at network nodes and the normal host pointers at full address nodes use the PTR RR to point back to the primary domain names of the corresponding hosts.<br><em>网络节点上的网关指针和全地址节点上的普通主机指针都使用PTR RR来指向对应主机的主域名。</em></p>
<p>For example, the IN-ADDR.ARPA domain will contain information about the ISI gateway between net 10 and 26, an MIT gateway from net 10 to MIT’s net 18, and hosts A.ISI.EDU and MULTICS.MIT.EDU.  Assuming that ISI gateway has addresses 10.2.0.22 and 26.0.0.103, and a name MILNET-GW.ISI.EDU, and the MIT gateway has addresses 10.0.0.77 and 18.10.0.4 and a name GW.LCS.MIT.EDU, the domain database would contain:<br><em>例如，IN-ADDR.ARPA 域将包含有关网络 10 和 26 之间的 ISI 网关、从网络 10 到 MIT 的网络 18 的 MIT 网关以及主机 A.ISI.EDU 和 MULTICS.MIT.EDU 的信息。 假设 ISI 网关的地址为 10.2.0.22 和 26.0.0.103，名称为 MILNET-GW.ISI.EDU，MIT 网关的地址为 10.0.0.77 和 18.10.0.4，名称为 GW.LCS.MIT.EDU，则 域数据库将包含：</em></p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><code class="hljs stylus"><span class="hljs-number">10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR MILNET-GW<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR GW<span class="hljs-selector-class">.LCS</span><span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">18</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR GW<span class="hljs-selector-class">.LCS</span><span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">26</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR MILNET-GW<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">22.0</span>.<span class="hljs-number">2.10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.    PTR MILNET-GW<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">103.0</span>.<span class="hljs-number">0.26</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.   PTR MILNET-GW<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">77.0</span>.<span class="hljs-number">0.10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.    PTR GW<span class="hljs-selector-class">.LCS</span><span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">4.0</span>.<span class="hljs-number">10.18</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.    PTR GW<span class="hljs-selector-class">.LCS</span><span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">103.0</span>.<span class="hljs-number">3.26</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.   PTR A<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">6.0</span>.<span class="hljs-number">0.10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.     PTR MULTICS<span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br></code></pre></td></tr></table></figure>
<p>Thus a program which wanted to locate gateways on net 10 would originate a query of the form QTYPE=PTR, QCLASS=IN, QNAME=10.IN-ADDR.ARPA.  It would receive two RRs in response:<br><em>因此，想要定位网络 10 上的网关的程序将发起 QTYPE=PTR、QCLASS=IN、QNAME=10.IN-ADDR.ARPA 形式的查询。 它将收到两个 RR 响应：</em></p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs stylus"><span class="hljs-number">10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR MILNET-GW<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br><span class="hljs-number">10</span><span class="hljs-selector-class">.IN-ADDR</span><span class="hljs-selector-class">.ARPA</span>.           PTR GW<span class="hljs-selector-class">.LCS</span><span class="hljs-selector-class">.MIT</span><span class="hljs-selector-class">.EDU</span>.<br></code></pre></td></tr></table></figure>
<p>The program could then originate QTYPE=A, QCLASS=IN queries for MILNET-GW.ISI.EDU. and GW.LCS.MIT.EDU. to discover the Internet addresses of these gateways.<br><em>然后，程序可以为 MILNET-GW.ISI.EDU 发起 QTYPE=A、QCLASS=IN 查询。 和 GW.LCS.MIT.EDU。 发现这些网关的互联网地址。</em></p>
<p>A resolver which wanted to find the host name corresponding to Internet host address 10.0.0.6 would pursue a query of the form QTYPE=PTR, QCLASS=IN, QNAME=6.0.0.10.IN-ADDR.ARPA, and would receive:<br><em>想要查找与 Internet 主机地址 10.0.0.6 相对应的主机名的解析器将执行 QTYPE=PTR、QCLASS=IN、QNAME=6.0.0.10.IN-ADDR.ARPA 形式的查询，并会收到：</em></p>
<figure class="highlight accesslog"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs accesslog"><span class="hljs-number">6.0.0.10</span>.IN-ADDR.ARPA.     PTR MULTICS.MIT.EDU.<br></code></pre></td></tr></table></figure>

<p>Several cautions apply to the use of these services:<br><em>使用这些服务时需要注意一些注意事项：</em></p>
<ul>
<li>Since the IN-ADDR.ARPA special domain and the normal domain for a particular host or gateway will be in different zones, the possibility exists that that the data may be inconsistent.</li>
</ul>
<p>   <em>由于IN-ADDR.ARPA特殊域和特定主机或网关的普通域位于不同的区域，因此存在数据不一致的可能性。</em></p>
<ul>
<li>Gateways will often have two names in separate domains, only one of which can be primary.</li>
</ul>
<p>   <em>网关通常在不同的域中有两个名称，其中只有一个可以是主名称。</em></p>
<ul>
<li>Systems that use the domain database to initialize their routing tables must start with enough gateway information to guarantee that they can access the appropriate name server.</li>
</ul>
<p>   <em>使用域数据库初始化其路由表的系统必须以足够的网关信息开始，以保证它们可以访问适当的名称服务器。</em></p>
<ul>
<li>The gateway data only reflects the existence of a gateway in a manner equivalent to the current HOSTS.TXT file.  It doesn’t  replace the dynamic availability information from GGP or EGP.</li>
</ul>
<p>   <em>网关数据仅以与当前HOSTS.TXT文件等效的方式反映网关的存在。 它不会取代来自 GGP 或 EGP 的动态可用性信息。</em></p>
<h2 id="3-6-Defining-new-types-classes-and-special-namespaces"><a href="#3-6-Defining-new-types-classes-and-special-namespaces" class="headerlink" title="3.6. Defining new types, classes, and special namespaces"></a>3.6. Defining new types, classes, and special namespaces</h2><p>The previously defined types and classes are the ones in use as of the date of this memo.  New definitions should be expected.  This section makes some recommendations to designers considering additions to the existing facilities.  The mailing list <a href="mailto:&#x4e;&#65;&#77;&#69;&#68;&#x52;&#79;&#x50;&#x50;&#69;&#x52;&#83;&#64;&#83;&#x52;&#73;&#x2d;&#x4e;&#73;&#67;&#46;&#65;&#x52;&#80;&#x41;">&#x4e;&#65;&#77;&#69;&#68;&#x52;&#79;&#x50;&#x50;&#69;&#x52;&#83;&#64;&#83;&#x52;&#73;&#x2d;&#x4e;&#73;&#67;&#46;&#65;&#x52;&#80;&#x41;</a> is the forum where general discussion of design issues takes place.</p>
<p>In general, a new type is appropriate when new information is to be added to the database about an existing object, or we need new data formats for some totally new object.  Designers should attempt to define types and their RDATA formats that are generally applicable to all classes, and which avoid duplication of information.  New classes are appropriate when the DNS is to be used for a new protocol, etc which requires new class-specific data formats, or when a copy of the existing name space is desired, but a separate management domain is necessary.</p>
<p>New types and classes need mnemonics for master files; the format of the master files requires that the mnemonics for type and class be disjoint.</p>
<p>TYPE and CLASS values must be a proper subset of QTYPEs and QCLASSes respectively.</p>
<p>The present system uses multiple RRs to represent multiple values of a type rather than storing multiple values in the RDATA section of a single RR.  This is less efficient for most applications, but does keep RRs shorter.  The multiple RRs assumption is incorporated in some experimental work on dynamic update methods.</p>
<p>The present system attempts to minimize the duplication of data in the database in order to insure consistency.  Thus, in order to find the address of the host for a mail exchange, you map the mail domain name to a host name, then the host name to addresses, rather than a direct mapping to host address.  This approach is preferred because it avoids the opportunity for inconsistency.</p>
<p>In defining a new type of data, multiple RR types should not be used to create an ordering between entries or express different formats for equivalent bindings, instead this information should be carried in the body of the RR and a single type used.  This policy avoids problems with caching multiple types and defining QTYPEs to match multiple types.</p>
<p>For example, the original form of mail exchange binding used two RR types one to represent a “closer” exchange (MD) and one to represent a “less close” exchange (MF).  The difficulty is that the presence of one RR type in a cache doesn’t convey any information about the other because the query which acquired the cached information might have used a QTYPE of MF, MD, or MAILA (which matched both).  The redesigned service used a single type (MX) with a “preference” value in the RDATA section which can order different RRs.  However, if any MX RRs are found in the cache, then all should be there.</p>
<h1 id="4-MESSAGES"><a href="#4-MESSAGES" class="headerlink" title="4.  MESSAGES"></a>4.  MESSAGES</h1><h2 id="4-1-Format"><a href="#4-1-Format" class="headerlink" title="4.1.  Format"></a>4.1.  Format</h2><p>All communications inside of the domain protocol are carried in a single format called a message.  The top level format of message is divided into 5 sections (some of which are empty in certain cases) shown below:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+---------------------+</span><br><span class="hljs-section">|        Header       |</span><br><span class="hljs-section">+---------------------+</span><br><span class="hljs-section">|       Question      | the question for the name server</span><br><span class="hljs-section">+---------------------+</span><br><span class="hljs-section">|        Answer       | RRs answering the question</span><br><span class="hljs-section">+---------------------+</span><br><span class="hljs-section">|      Authority      | RRs pointing toward an authority</span><br><span class="hljs-section">+---------------------+</span><br><span class="hljs-section">|      Additional     | RRs holding additional information</span><br><span class="hljs-section">+---------------------+</span><br></code></pre></td></tr></table></figure>
<p>The header section is always present.  The header includes fields that specify which of the remaining sections are present, and also specify whether the message is a query or a response, a standard query or some other opcode, etc.</p>
<p>The names of the sections after the header are derived from their use in standard queries.  The question section contains fields that describe a question to a name server.  These fields are a query type (QTYPE), a query class (QCLASS), and a query domain name (QNAME).  The last three sections have the same format: a possibly empty list of concatenated resource records (RRs).  The answer section contains RRs that answer the question; the authority section contains RRs that point toward an authoritative name server; the additional records section contains RRs which relate to the query, but are not strictly answers for the question.</p>
<h3 id="4-1-1-Header-section-format"><a href="#4-1-1-Header-section-format" class="headerlink" title="4.1.1. Header section format"></a>4.1.1. Header section format</h3><p>The header contains the following fields:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">                                1  1  1  1  1  1</span><br><span class="hljs-section">  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                      ID                       |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                    QDCOUNT                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                    ANCOUNT                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                    NSCOUNT                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                    ARCOUNT                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>ID              A 16 bit identifier assigned by the program that generates any kind of query.  This identifier is copied the corresponding reply and can be used by the requester to match up replies to outstanding queries.</p>
<p>QR              A one bit field that specifies whether this message is a query (0), or a response (1).</p>
<p>OPCODE          A four bit field that specifies kind of query in this message.  This value is set by the originator of a query and copied into the response.  The values are:</p>
<div class="code-wrapper"><pre><code class="hljs">            0                 a standard query (QUERY)

            1               an inverse query (IQUERY)

            2                a server status request (STATUS)

            3-15            reserved for future use
</code></pre></div>
<p>AA              Authoritative Answer - this bit is valid in responses, and specifies that the responding name server is an authority for the domain name in question section.</p>
<div class="code-wrapper"><pre><code class="hljs">            Note that the contents of the answer section may have multiple owner names because of aliases.  The AA bit corresponds to the name which matches the query name, or the first owner name in the answer section.
</code></pre></div>
<p>TC              TrunCation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.</p>
<p>RD              Recursion Desired - this bit may be set in a query and is copied into the response.  If RD is set, it directs the name server to pursue the query recursively. Recursive query support is optional.</p>
<p>RA              Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.</p>
<p>Z               Reserved for future use.  Must be zero in all queries and responses.</p>
<p>RCODE           Response code - this 4 bit field is set as part of responses.  The values have the following interpretation:</p>
<div class="code-wrapper"><pre><code class="hljs">            0               No error condition

            1               Format error - The name server was unable to interpret the query.

            2               Server failure - The name server was unable to process this query due to a problem with the name server.

            3               Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.

            4               Not Implemented - The name server does not support the requested kind of query.

            5               Refused - The name server refuses to perform the specified operation for policy reasons.  For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.

            6-15            Reserved for future use.
</code></pre></div>
<p>QDCOUNT         an unsigned 16 bit integer specifying the number of entries in the question section.</p>
<p>ANCOUNT         an unsigned 16 bit integer specifying the number of resource records in the answer section.</p>
<p>NSCOUNT         an unsigned 16 bit integer specifying the number of name server resource records in the authority records section.</p>
<p>ARCOUNT         an unsigned 16 bit integer specifying the number of resource records in the additional records section.</p>
<h3 id="4-1-2-Question-section-format"><a href="#4-1-2-Question-section-format" class="headerlink" title="4.1.2. Question section format"></a>4.1.2. Question section format</h3><p>The question section is used to carry the “question” in most queries, i.e., the parameters that define what is being asked.  The section contains QDCOUNT (usually 1) entries, each of the following format:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">                                1  1  1  1  1  1</span><br><span class="hljs-section">  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                                               |<br>/                     QNAME                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                     QTYPE                     |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                     QCLASS                    |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>QNAME           a domain name represented as a sequence of labels, where each label consists of a length octet followed by that number of octets.  The domain name terminates with the zero length octet for the null label of the root.  Note that this field may be an odd number of octets; no padding is used.</p>
<p>QTYPE           a two octet code which specifies the type of the query. The values for this field include all codes valid for a TYPE field, together with some more general codes which can match more than one type of RR.</p>
<p>QCLASS          a two octet code that specifies the class of the query. For example, the QCLASS field is IN for the Internet.</p>
<h3 id="4-1-3-Resource-record-format"><a href="#4-1-3-Resource-record-format" class="headerlink" title="4.1.3. Resource record format"></a>4.1.3. Resource record format</h3><p>The answer, authority, and additional sections all share the same format: a variable number of resource records, where the number of records is specified in the corresponding count field in the header. Each resource record has the following format:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">                                1  1  1  1  1  1</span><br><span class="hljs-section">  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                                               |<br>/                                               /<br>/                      NAME                     /<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                      TYPE                     |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br><span class="hljs-section">|                     CLASS                     |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                      TTL                      |<br><span class="hljs-section">|                                               |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br>|                   RDLENGTH                    |<br><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--|<br>/                     RDATA                     /<br><span class="hljs-section">/                                               /</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>where:</p>
<p>NAME            a domain name to which this resource record pertains. </p>
<p>TYPE            two octets containing one of the RR type codes.  This field specifies the meaning of the data in the RDATA field.</p>
<p>CLASS           two octets which specify the class of the data in the RDATA field.</p>
<p>TTL             a 32 bit unsigned integer that specifies the time interval (in seconds) that the resource record may be cached before it should be discarded.  Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached.</p>
<p>RDLENGTH        an unsigned 16 bit integer that specifies the length in octets of the RDATA field.</p>
<p>RDATA           a variable length string of octets that describes the resource.  The format of this information varies according to the TYPE and CLASS of the resource record. For example, the if the TYPE is A and the CLASS is IN, the RDATA field is a 4 octet ARPA Internet address.</p>
<h3 id="4-1-4-Message-compression"><a href="#4-1-4-Message-compression" class="headerlink" title="4.1.4.  Message compression"></a>4.1.4.  Message compression</h3><p>In order to reduce the size of messages, the domain system utilizes a compression scheme which eliminates the repetition of domain names in a message.  In this scheme, an entire domain name or a list of labels at the end of a domain name is replaced with a pointer to a prior occurance of the same name.</p>
<p>The pointer takes the form of a two octet sequence:</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs asciidoc"><span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--<span class="hljs-code">+--+</span>--+<br><span class="hljs-section">| 1  1|                OFFSET                   |</span><br><span class="hljs-section">+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</span><br></code></pre></td></tr></table></figure>
<p>The first two bits are ones.  This allows a pointer to be distinguished from a label, since the label must begin with two zero bits because labels are restricted to 63 octets or less.  (The 10 and 01 combinations are reserved for future use.)  The OFFSET field specifies an offset from the start of the message (i.e., the first octet of the ID field in the domain header).  A zero offset specifies the first byte of the ID field, etc.</p>
<p>The compression scheme allows a domain name in a message to be represented as either:</p>
<ul>
<li><p>a sequence of labels ending in a zero octet</p>
</li>
<li><p>a pointer</p>
</li>
<li><p>a sequence of labels ending with a pointer</p>
</li>
</ul>
<p>Pointers can only be used for occurances of a domain name where the format is not class specific.  If this were not the case, a name server or resolver would be required to know the format of all RRs it handled. As yet, there are no such cases, but they may occur in future RDATA formats.</p>
<p>If a domain name is contained in a part of the message subject to a length field (such as the RDATA section of an RR), and compression is used, the length of the compressed name is used in the length calculation, rather than the length of the expanded name.</p>
<p>Programs are free to avoid using pointers in messages they generate, although this will reduce datagram capacity, and may cause truncation. However all programs are required to understand arriving messages that contain pointers.</p>
<p>For example, a datagram might need to use the domain names F.ISI.ARPA, FOO.F.ISI.ARPA, ARPA, and the root.  Ignoring the other fields of the message, these domain names might be represented as:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>20 |<span class="hljs-string">           1           </span>|<span class="hljs-string">           F           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>22 |<span class="hljs-string">           3           </span>|<span class="hljs-string">           I           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>24 |<span class="hljs-string">           S           </span>|<span class="hljs-string">           I           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>26 |<span class="hljs-string">           4           </span>|<span class="hljs-string">           A           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>28 |<span class="hljs-string">           R           </span>|<span class="hljs-string">           P           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>30 |<span class="hljs-string">           A           </span>|<span class="hljs-string">           0           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br><br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>40 |<span class="hljs-string">           3           </span>|<span class="hljs-string">           F           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>42 |<span class="hljs-string">           O           </span>|<span class="hljs-string">           O           </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>44 |<span class="hljs-string"> 1  1</span>|<span class="hljs-string">                20                       </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br><br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>64 |<span class="hljs-string"> 1  1</span>|<span class="hljs-string">                26                       </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br><br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br>92 |<span class="hljs-string">           0           </span>|<span class="hljs-string">                       </span>|<br>   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+<br></code></pre></td></tr></table></figure>
<p>The domain name for F.ISI.ARPA is shown at offset 20.  The domain name FOO.F.ISI.ARPA is shown at offset 40; this definition uses a pointer to concatenate a label for FOO to the previously defined F.ISI.ARPA.  The domain name ARPA is defined at offset 64 using a pointer to the ARPA component of the name F.ISI.ARPA at 20; note that this pointer relies on ARPA being the last label in the string at 20.  The root domain name is defined by a single octet of zeros at 92; the root domain name has no labels.</p>
<h2 id="4-2-Transport"><a href="#4-2-Transport" class="headerlink" title="4.2.  Transport"></a>4.2.  Transport</h2><p>The DNS assumes that messages will be transmitted as datagrams or in a byte stream carried by a virtual circuit.  While virtual circuits can be used for any DNS activity, datagrams are preferred for queries due to their lower overhead and better performance.  Zone refresh activities must use virtual circuits because of the need for reliable transfer.</p>
<p>The Internet supports name server access using TCP [RFC-793] on server port 53 (decimal) as well as datagram access using UDP [RFC-768] on UDP port 53 (decimal).</p>
<h3 id="4-2-1-UDP-usage"><a href="#4-2-1-UDP-usage" class="headerlink" title="4.2.1. UDP usage"></a>4.2.1. UDP usage</h3><p>Messages sent using UDP user server port 53 (decimal).</p>
<p>Messages carried by UDP are restricted to 512 bytes (not counting the IP or UDP headers).  Longer messages are truncated and the TC bit is set in the header.</p>
<p>UDP is not acceptable for zone transfers, but is the recommended method for standard queries in the Internet.  Queries sent using UDP may be lost, and hence a retransmission strategy is required.  Queries or their responses may be reordered by the network, or by processing in name servers, so resolvers should not depend on them being returned in order.</p>
<p>The optimal UDP retransmission policy will vary with performance of the Internet and the needs of the client, but the following are recommended:</p>
<ul>
<li><p>The client should try other servers and server addresses before repeating a query to a specific address of a server.</p>
</li>
<li><p>The retransmission interval should be based on prior statistics if possible.  Too aggressive retransmission can easily slow responses for the community at large.  Depending on how well connected the client is to its expected servers, the minimum retransmission interval should be 2-5 seconds.</p>
</li>
</ul>
<p>More suggestions on server selection and retransmission policy can be found in the resolver section of this memo.</p>
<h3 id="4-2-2-TCP-usage"><a href="#4-2-2-TCP-usage" class="headerlink" title="4.2.2. TCP usage"></a>4.2.2. TCP usage</h3><p> Messages sent over TCP connections use server port 53 (decimal).  The message is prefixed with a two byte length field which gives the message length, excluding the two byte length field.  This length field allows the low-level processing to assemble a complete message before beginning to parse it.</p>
<p>Several connection management policies are recommended:</p>
<ul>
<li><p>The server should not block other activities waiting for TCP data.</p>
</li>
<li><p>The server should support multiple connections.</p>
</li>
<li><p>The server should assume that the client will initiate connection closing, and should delay closing its end of the connection until all outstanding client requests have been satisfied.</p>
</li>
<li><p>If the server needs to close a dormant connection to reclaim resources, it should wait until the connection has been idle for a period on the order of two minutes.  In particular, the server should allow the SOA and AXFR request sequence (which begins a refresh operation) to be made on a single connection. Since the server would be unable to answer queries anyway, a unilateral close or reset may be used instead of a graceful close.</p>
</li>
</ul>
<h1 id="5-MASTER-FILES"><a href="#5-MASTER-FILES" class="headerlink" title="5. MASTER FILES"></a>5. MASTER FILES</h1><p>Master files are text files that contain RRs in text form.  Since the contents of a zone can be expressed in the form of a list of RRs a master file is most often used to define a zone, though it can be used to list a cache’s contents.  Hence, this section first discusses the format of RRs in a master file, and then the special considerations when a master file is used to create a zone in some name server.</p>
<h2 id="5-1-Format"><a href="#5-1-Format" class="headerlink" title="5.1. Format"></a>5.1. Format</h2><p>The format of these files is a sequence of entries.  Entries are predominantly line-oriented, though parentheses can be used to continue a list of items across a line boundary, and text literals can contain CRLF within the text.  Any combination of tabs and spaces act as a delimiter between the separate items that make up an entry.  The end of any line in the master file can end with a comment.  The comment starts with a “;” (semicolon).</p>
<p>The following entries are defined:</p>
<figure class="highlight fsharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs fsharp">&lt;blank&gt;<span class="hljs-meta">[&lt;comment&gt;]</span><br><br>$ORIGIN &lt;domain-name&gt; <span class="hljs-meta">[&lt;comment&gt;]</span><br><br>$INCLUDE &lt;file-name&gt; <span class="hljs-meta">[&lt;domain-name&gt;]</span> <span class="hljs-meta">[&lt;comment&gt;]</span><br><br>&lt;domain-name&gt;&lt;rr&gt; <span class="hljs-meta">[&lt;comment&gt;]</span><br><br>&lt;blank&gt;&lt;rr&gt; <span class="hljs-meta">[&lt;comment&gt;]</span><br></code></pre></td></tr></table></figure>
<p>Blank lines, with or without comments, are allowed anywhere in the file.</p>
<p>Two control entries are defined: $ORIGIN and $INCLUDE.  $ORIGIN is followed by a domain name, and resets the current origin for relative domain names to the stated name.  $INCLUDE inserts the named file into the current file, and may optionally specify a domain name that sets the relative domain name origin for the included file.  $INCLUDE may also have a comment.  Note that a $INCLUDE entry never changes the relative origin of the parent file, regardless of changes to the relative origin made within the included file.</p>
<p>The last two forms represent RRs.  If an entry for an RR begins with a blank, then the RR is assumed to be owned by the last stated owner.  If an RR entry begins with a <domain-name>, then the owner name is reset.</p>
<p><rr> contents take one of the following forms:</p>
<figure class="highlight fsharp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs fsharp"><span class="hljs-meta">[&lt;TTL&gt;]</span> <span class="hljs-meta">[&lt;class&gt;]</span> &lt;<span class="hljs-class"><span class="hljs-keyword">type</span>&gt; &lt;RDATA&gt;</span><br><br><span class="hljs-meta">[&lt;class&gt;]</span> <span class="hljs-meta">[&lt;TTL&gt;]</span> &lt;<span class="hljs-class"><span class="hljs-keyword">type</span>&gt; &lt;RDATA&gt;</span><br></code></pre></td></tr></table></figure>
<p>The RR begins with optional TTL and class fields, followed by a type and RDATA field appropriate to the type and class.  Class and type use the standard mnemonics, TTL is a decimal integer.  Omitted class and TTL values are default to the last explicitly stated values.  Since type and class mnemonics are disjoint, the parse is unique.  (Note that this order is different from the order used in examples and the order used in the actual RRs; the given order allows easier parsing and defaulting.)</p>
<p><domain-name>s make up a large share of the data in the master file.<br>The labels in the domain name are expressed as character strings and separated by dots.  Quoting conventions allow arbitrary characters to be stored in domain names.  Domain names that end in a dot are called absolute, and are taken as complete.  Domain names which do not end in a dot are called relative; the actual domain name is the concatenation of the relative part with an origin specified in a $ORIGIN, $INCLUDE, or as an argument to the master file loading routine.  A relative name is an error when no origin is available.</p>
<p><character-string> is expressed in one or two ways: as a contiguous set of characters without interior spaces, or as a string beginning with a “and ending with a “.  Inside a “ delimited string any character can occur, except for a “ itself, which must be quoted using \ (back slash).</p>
<p>Because these files are text files several special encodings are necessary to allow arbitrary data to be loaded.  In particular:</p>
<figure class="highlight pgsql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs pgsql">                <span class="hljs-keyword">of</span> the root.<br><br>@               A free standing @ <span class="hljs-keyword">is</span> used <span class="hljs-keyword">to</span> denote the <span class="hljs-keyword">current</span> origin.<br><br>\X              <span class="hljs-keyword">where</span> X <span class="hljs-keyword">is</span> <span class="hljs-keyword">any</span> <span class="hljs-type">character</span> other than a digit (<span class="hljs-number">0</span><span class="hljs-number">-9</span>), <span class="hljs-keyword">is</span> used <span class="hljs-keyword">to</span> <span class="hljs-keyword">quote</span> that <span class="hljs-type">character</span> so that its special meaning does <span class="hljs-keyword">not</span> apply.  <span class="hljs-keyword">For</span> example, &quot;\.&quot; can be used <span class="hljs-keyword">to</span> place a dot <span class="hljs-type">character</span> <span class="hljs-keyword">in</span> a label.<br><br>\DDD            <span class="hljs-keyword">where</span> <span class="hljs-keyword">each</span> D <span class="hljs-keyword">is</span> a digit <span class="hljs-keyword">is</span> the octet corresponding <span class="hljs-keyword">to</span> the <span class="hljs-type">decimal</span> number described <span class="hljs-keyword">by</span> DDD.  The resulting octet <span class="hljs-keyword">is</span> assumed <span class="hljs-keyword">to</span> be <span class="hljs-type">text</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> checked <span class="hljs-keyword">for</span> special meaning.<br><br>( )             Parentheses are used <span class="hljs-keyword">to</span> <span class="hljs-keyword">group</span> data that crosses a <span class="hljs-type">line</span> boundary.  <span class="hljs-keyword">In</span> effect, <span class="hljs-type">line</span> terminations are <span class="hljs-keyword">not</span> recognized <span class="hljs-keyword">within</span> parentheses.<br><br>;               Semicolon <span class="hljs-keyword">is</span> used <span class="hljs-keyword">to</span> <span class="hljs-keyword">start</span> a <span class="hljs-keyword">comment</span>; the remainder <span class="hljs-keyword">of</span> the <span class="hljs-type">line</span> <span class="hljs-keyword">is</span> ignored.<br></code></pre></td></tr></table></figure>
<h2 id="5-2-Use-of-master-files-to-define-zones"><a href="#5-2-Use-of-master-files-to-define-zones" class="headerlink" title="5.2. Use of master files to define zones"></a>5.2. Use of master files to define zones</h2><p>When a master file is used to load a zone, the operation should be suppressed if any errors are encountered in the master file.  The rationale for this is that a single error can have widespread consequences.  For example, suppose that the RRs defining a delegation have syntax errors; then the server will return authoritative name errors for all names in the subzone (except in the case where the subzone is also present on the server).</p>
<p>Several other validity checks that should be performed in addition to insuring that the file is syntactically correct:</p>
<ol>
<li><p>All RRs in the file should have the same class.</p>
</li>
<li><p>Exactly one SOA RR should be present at the top of the zone.</p>
</li>
<li><p>If delegations are present and glue information is required, it should be present.</p>
</li>
<li><p>Information present outside of the authoritative nodes in the zone should be glue information, rather than the result of an origin or similar error.</p>
</li>
</ol>
<h2 id="5-3-Master-file-example"><a href="#5-3-Master-file-example" class="headerlink" title="5.3. Master file example"></a>5.3. Master file example</h2><p>The following is an example file which might be used to define the ISI.EDU zone.and is loaded with an origin of ISI.EDU:</p>
<figure class="highlight dns"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><code class="hljs dns">@   <span class="hljs-keyword">IN</span>  <span class="hljs-keyword">SOA</span>     VENERA      Action\.domains (<br>                                 <span class="hljs-number">20</span>     <span class="hljs-comment">; SERIAL</span><br>                                 <span class="hljs-number">7200</span>   <span class="hljs-comment">; REFRESH</span><br>                                 <span class="hljs-number">600</span>    <span class="hljs-comment">; RETRY</span><br>                                 <span class="hljs-number">3600000</span><span class="hljs-comment">; EXPIRE</span><br>                                 <span class="hljs-number">60</span>)    <span class="hljs-comment">; MINIMUM</span><br><br>        <span class="hljs-keyword">NS</span>      <span class="hljs-keyword">A</span>.ISI.EDU.<br>        <span class="hljs-keyword">NS</span>      VENERA<br>        <span class="hljs-keyword">NS</span>      VAXA<br>        <span class="hljs-keyword">MX</span>      <span class="hljs-number">10</span>      VENERA<br>        <span class="hljs-keyword">MX</span>      <span class="hljs-number">20</span>      VAXA<br><br><span class="hljs-keyword">A</span>       <span class="hljs-keyword">A</span>       <span class="hljs-number">26.3.0.103</span><br><br>VENERA  <span class="hljs-keyword">A</span>       <span class="hljs-number">10.1.0.52</span><br>        <span class="hljs-keyword">A</span>       <span class="hljs-number">128.9.0.32</span><br><br>VAXA    <span class="hljs-keyword">A</span>       <span class="hljs-number">10.2.0.27</span><br>        <span class="hljs-keyword">A</span>       <span class="hljs-number">128.9.0.33</span><br><br><br><span class="hljs-meta">$INCLUDE</span> &lt;SUBSYS&gt;ISI-MAILBOXES.<span class="hljs-keyword">TXT</span><br></code></pre></td></tr></table></figure>
<p>Where the file <SUBSYS>ISI-MAILBOXES.TXT is:</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs stylus">MOE     MB      A<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br>LARRY   MB      A<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br>CURLEY  MB      A<span class="hljs-selector-class">.ISI</span><span class="hljs-selector-class">.EDU</span>.<br>STOOGES MG      MOE<br>        MG      LARRY<br>        MG      CURLEY<br></code></pre></td></tr></table></figure>
<p>Note the use of the \ character in the SOA RR to specify the responsible person mailbox “<a href="mailto:&#x41;&#99;&#x74;&#105;&#111;&#110;&#46;&#100;&#x6f;&#x6d;&#97;&#105;&#x6e;&#x73;&#64;&#69;&#46;&#x49;&#x53;&#73;&#46;&#x45;&#x44;&#x55;">&#x41;&#99;&#x74;&#105;&#111;&#110;&#46;&#100;&#x6f;&#x6d;&#97;&#105;&#x6e;&#x73;&#64;&#69;&#46;&#x49;&#x53;&#73;&#46;&#x45;&#x44;&#x55;</a>“.</p>
<h1 id="6-NAME-SERVER-IMPLEMENTATION"><a href="#6-NAME-SERVER-IMPLEMENTATION" class="headerlink" title="6. NAME SERVER IMPLEMENTATION"></a>6. NAME SERVER IMPLEMENTATION</h1><h2 id="6-1-Architecture"><a href="#6-1-Architecture" class="headerlink" title="6.1. Architecture"></a>6.1. Architecture</h2><p>The optimal structure for the name server will depend on the host operating system and whether the name server is integrated with resolver operations, either by supporting recursive service, or by sharing its database with a resolver.  This section discusses implementation considerations for a name server which shares a database with a resolver, but most of these concerns are present in any name server.</p>
<h3 id="6-1-1-Control"><a href="#6-1-1-Control" class="headerlink" title="6.1.1. Control"></a>6.1.1. Control</h3><p>A name server must employ multiple concurrent activities, whether they are implemented as separate tasks in the host’s OS or multiplexing inside a single name server program.  It is simply not acceptable for a name server to block the service of UDP requests while it waits for TCP data for refreshing or query activities.  Similarly, a name server should not attempt to provide recursive service without processing such requests in parallel, though it may choose to serialize requests from a single client, or to regard identical requests from the same client as duplicates.  A name server should not substantially delay requests while it reloads a zone from master files or while it incorporates a newly refreshed zone into its database.</p>
<h3 id="6-1-2-Database"><a href="#6-1-2-Database" class="headerlink" title="6.1.2. Database"></a>6.1.2. Database</h3><p>While name server implementations are free to use any internal data structures they choose, the suggested structure consists of three major parts:</p>
<ul>
<li><p>A “catalog” data structure which lists the zones available to this server, and a “pointer” to the zone data structure.  The main purpose of this structure is to find the nearest ancestor zone, if any, for arriving standard queries.</p>
</li>
<li><p>Separate data structures for each of the zones held by the name server.</p>
</li>
<li><p>A data structure for cached data. (or perhaps separate caches for different classes)</p>
</li>
</ul>
<p>All of these data structures can be implemented an identical tree structure format, with different data chained off the nodes in different parts: in the catalog the data is pointers to zones, while in the zone and cache data structures, the data will be RRs.  In designing the tree framework the designer should recognize that query processing will need to traverse the tree using case-insensitive label comparisons; and that in real data, a few nodes have a very high branching factor (100-1000 or more), but the vast majority have a very low branching factor (0-1).</p>
<p>One way to solve the case problem is to store the labels for each node in two pieces: a standardized-case representation of the label where all ASCII characters are in a single case, together with a bit mask that denotes which characters are actually of a different case.  The branching factor diversity can be handled using a simple linked list for a node until the branching factor exceeds some threshold, and transitioning to a hash structure after the threshold is exceeded.  In any case, hash structures used to store tree sections must insure that hash functions and procedures preserve the casing conventions of the DNS.</p>
<p>The use of separate structures for the different parts of the database is motivated by several factors:</p>
<ul>
<li><p>The catalog structure can be an almost static structure that need change only when the system administrator changes the zones supported by the server.  This structure can also be used to store parameters used to control refreshing activities.</p>
</li>
<li><p>The individual data structures for zones allow a zone to be replaced simply by changing a pointer in the catalog.  Zone refresh operations can build a new structure and, when complete, splice it into the database via a simple pointer replacement.  It is very important that when a zone is refreshed, queries should not use old and new data simultaneously.</p>
</li>
<li><p>With the proper search procedures, authoritative data in zones will always “hide”, and hence take precedence over, cached data.</p>
</li>
<li><p>Errors in zone definitions that cause overlapping zones, etc., may cause erroneous responses to queries, but problem determination is simplified, and the contents of one “bad” zone can’t corrupt another.</p>
</li>
<li><p>Since the cache is most frequently updated, it is most vulnerable to corruption during system restarts.  It can also become full of expired RR data.  In either case, it can easily be discarded without disturbing zone data.</p>
</li>
</ul>
<p>A major aspect of database design is selecting a structure which allows the name server to deal with crashes of the name server’s host.  State information which a name server should save across system crashes includes the catalog structure (including the state of refreshing for each zone) and the zone data itself.</p>
<h3 id="6-1-3-Time"><a href="#6-1-3-Time" class="headerlink" title="6.1.3. Time"></a>6.1.3. Time</h3><p>Both the TTL data for RRs and the timing data for refreshing activities depends on 32 bit timers in units of seconds.  Inside the database, refresh timers and TTLs for cached data conceptually “count down”, while data in the zone stays with constant TTLs.</p>
<p>A recommended implementation strategy is to store time in two ways:  as a relative increment and as an absolute time.  One way to do this is to use positive 32 bit numbers for one type and negative numbers for the other.  The RRs in zones use relative times; the refresh timers and cache data use absolute times.  Absolute numbers are taken with respect to some known origin and converted to relative values when placed in the response to a query.  When an absolute TTL is negative after conversion to relative, then the data is expired and should be ignored.</p>
<h2 id="6-2-Standard-query-processing"><a href="#6-2-Standard-query-processing" class="headerlink" title="6.2. Standard query processing"></a>6.2. Standard query processing</h2><p>The major algorithm for standard query processing is presented in [RFC-1034].</p>
<p>When processing queries with QCLASS=*, or some other QCLASS which matches multiple classes, the response should never be authoritative unless the server can guarantee that the response covers all classes.</p>
<p>When composing a response, RRs which are to be inserted in the additional section, but duplicate RRs in the answer or authority sections, may be omitted from the additional section.</p>
<p>When a response is so long that truncation is required, the truncation should start at the end of the response and work forward in the datagram.  Thus if there is any data for the authority section, the answer section is guaranteed to be unique.</p>
<p>The MINIMUM value in the SOA should be used to set a floor on the TTL of data distributed from a zone.  This floor function should be done when the data is copied into a response.  This will allow future dynamic update protocols to change the SOA MINIMUM field without ambiguous semantics.</p>
<h2 id="6-3-Zone-refresh-and-reload-processing"><a href="#6-3-Zone-refresh-and-reload-processing" class="headerlink" title="6.3. Zone refresh and reload processing"></a>6.3. Zone refresh and reload processing</h2><p>In spite of a server’s best efforts, it may be unable to load zone data from a master file due to syntax errors, etc., or be unable to refresh a zone within the its expiration parameter.  In this case, the name server should answer queries as if it were not supposed to possess the zone.</p>
<p>If a master is sending a zone out via AXFR, and a new version is created during the transfer, the master should continue to send the old version if possible.  In any case, it should never send part of one version and part of another.  If completion is not possible, the master should reset the connection on which the zone transfer is taking place.</p>
<h2 id="6-4-Inverse-queries-Optional"><a href="#6-4-Inverse-queries-Optional" class="headerlink" title="6.4. Inverse queries (Optional)"></a>6.4. Inverse queries (Optional)</h2><p>Inverse queries are an optional part of the DNS.  Name servers are not required to support any form of inverse queries.  If a name server receives an inverse query that it does not support, it returns an error response with the “Not Implemented” error set in the header.  While inverse query support is optional, all name servers must be at least able to return the error response.</p>
<h3 id="6-4-1-The-contents-of-inverse-queries-and-responses"><a href="#6-4-1-The-contents-of-inverse-queries-and-responses" class="headerlink" title="6.4.1. The contents of inverse queries and responses."></a>6.4.1. The contents of inverse queries and responses.</h3><p>Inverse queries reverse the mappings performed by standard query operations; while a standard query maps a domain name to a resource, an inverse query maps a resource to a domain name.  For example, a standard query might bind a domain name to a host address; the corresponding inverse query binds the host address to a domain name.</p>
<p>Inverse queries take the form of a single RR in the answer section of the message, with an empty question section.  The owner name of the query RR and its TTL are not significant.  The response carries questions in the question section which identify all names possessing the query RR WHICH THE NAME SERVER KNOWS.  Since no name server knows about all of the domain name space, the response can never be assumed to be complete.  Thus inverse queries are primarily useful for database management and debugging activities.  Inverse queries are NOT an acceptable method of mapping host addresses to host names; use the IN-ADDR.ARPA domain instead.</p>
<p>Where possible, name servers should provide case-insensitive comparisons for inverse queries.  Thus an inverse query asking for an MX RR of “Venera.isi.edu” should get the same response as a query for “VENERA.ISI.EDU”; an inverse query for HINFO RR “IBM-PC UNIX” should produce the same result as an inverse query for “IBM-pc unix”.  However, this cannot be guaranteed because name servers may possess RRs that contain character strings but the name server does not know that the data is character.</p>
<p>When a name server processes an inverse query, it either returns:</p>
<ol>
<li><p>zero, one, or multiple domain names for the specified resource as QNAMEs in the question section</p>
</li>
<li><p>an error code indicating that the name server doesn’t support inverse mapping of the specified resource type.</p>
</li>
</ol>
<p>When the response to an inverse query contains one or more QNAMEs, the owner name and TTL of the RR in the answer section which defines the inverse query is modified to exactly match an RR found at the first QNAME.</p>
<p>RRs returned in the inverse queries cannot be cached using the same mechanism as is used for the replies to standard queries.  One reason for this is that a name might have multiple RRs of the same type, and only one would appear.  For example, an inverse query for a single address of a multiply homed host might create the impression that only one address existed.</p>
<h3 id="6-4-2-Inverse-query-and-response-example"><a href="#6-4-2-Inverse-query-and-response-example" class="headerlink" title="6.4.2. Inverse query and response example"></a>6.4.2. Inverse query and response example</h3><p>The overall structure of an inverse query for retrieving the domain name that corresponds to Internet address 10.1.0.52 is shown below:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">                +-----------------------------------------+<br>  Header        |<span class="hljs-string">          OPCODE=IQUERY, ID=997          </span>|<br>                +-----------------------------------------+<br> Question       |<span class="hljs-string">                 &lt;empty&gt;                 </span>|<br>                +-----------------------------------------+<br>  Answer        |<span class="hljs-string">        &lt;anyname&gt; A IN 10.1.0.52         </span>|<br>                +-----------------------------------------+<br> Authority      |<span class="hljs-string">                 &lt;empty&gt;                 </span>|<br>                +-----------------------------------------+<br>Additional      |<span class="hljs-string">                 &lt;empty&gt;                 </span>|<br>                +-----------------------------------------+<br></code></pre></td></tr></table></figure>
<p>This query asks for a question whose answer is the Internet style address 10.1.0.52.  Since the owner name is not known, any domain name can be used as a placeholder (and is ignored).  A single octet of zero, signifying the root, is usually used because it minimizes the length of the message.  The TTL of the RR is not significant.<br>The response to this query might be:</p>
<figure class="highlight gherkin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs gherkin">                +-----------------------------------------+<br>  Header        |<span class="hljs-string">         OPCODE=RESPONSE, ID=997         </span>|<br>                +-----------------------------------------+<br> Question       |<span class="hljs-string">QTYPE=A, QCLASS=IN, QNAME=VENERA.ISI.EDU </span>|<br>                +-----------------------------------------+<br>  Answer        |<span class="hljs-string">  VENERA.ISI.EDU  A IN 10.1.0.52         </span>|<br>                +-----------------------------------------+<br> Authority      |<span class="hljs-string">                 &lt;empty&gt;                 </span>|<br>                +-----------------------------------------+<br>Additional      |<span class="hljs-string">                 &lt;empty&gt;                 </span>|<br>                +-----------------------------------------+<br></code></pre></td></tr></table></figure>
<p>Note that the QTYPE in a response to an inverse query is the same as the TYPE field in the answer section of the inverse query.  Responses to inverse queries may contain multiple questions when the inverse is not unique.  If the question section in the response is not empty, then the RR in the answer section is modified to correspond to be an exact copy of an RR at the first QNAME.</p>
<h3 id="6-4-3-Inverse-query-processing"><a href="#6-4-3-Inverse-query-processing" class="headerlink" title="6.4.3. Inverse query processing"></a>6.4.3. Inverse query processing</h3><p>Name servers that support inverse queries can support these operations through exhaustive searches of their databases, but this becomes impractical as the size of the database increases.  An alternative approach is to invert the database according to the search key.</p>
<p>For name servers that support multiple zones and a large amount of data, the recommended approach is separate inversions for each zone.  When a particular zone is changed during a refresh, only its inversions need to be redone.</p>
<p>Support for transfer of this type of inversion may be included in future versions of the domain system, but is not supported in this version.</p>
<h2 id="6-5-Completion-queries-and-responses"><a href="#6-5-Completion-queries-and-responses" class="headerlink" title="6.5. Completion queries and responses"></a>6.5. Completion queries and responses</h2><p>The optional completion services described in RFC-882 and RFC-883 have been deleted.  Redesigned services may become available in the future.</p>
<h1 id="7-RESOLVER-IMPLEMENTATION-解析器实现"><a href="#7-RESOLVER-IMPLEMENTATION-解析器实现" class="headerlink" title="7. RESOLVER IMPLEMENTATION(解析器实现)"></a>7. RESOLVER IMPLEMENTATION(解析器实现)</h1><p>The top levels of the recommended resolver algorithm are discussed in [RFC-1034].  This section discusses implementation details assuming the database structure suggested in the name server implementation section of this memo.</p>
<h2 id="7-1-Transforming-a-user-request-into-a-query-将用户请求转换为查询"><a href="#7-1-Transforming-a-user-request-into-a-query-将用户请求转换为查询" class="headerlink" title="7.1. Transforming a user request into a query(将用户请求转换为查询)"></a>7.1. Transforming a user request into a query(将用户请求转换为查询)</h2><p>The first step a resolver takes is to transform the client’s request, stated in a format suitable to the local OS, into a search specification for RRs at a specific name which match a specific QTYPE and QCLASS. Where possible, the QTYPE and QCLASS should correspond to a single type and a single class, because this makes the use of cached data much simpler.  The reason for this is that the presence of data of one type in a cache doesn’t confirm the existence or non-existence of data of other types, hence the only way to be sure is to consult an authoritative source.  If QCLASS=* is used, then authoritative answers won’t be available.</p>
<p>Since a resolver must be able to multiplex multiple requests if it is to perform its function efficiently, each pending request is usually represented in some block of state information.  This state block will typically contain:</p>
<ul>
<li><p>A timestamp indicating the time the request began. The timestamp is used to decide whether RRs in the database can be used or are out of date.  This timestamp uses the absolute time format previously discussed for RR storage in zones and caches.  Note that when an RRs TTL indicates a relative time, the RR must be timely, since it is part of a zone.  When the RR has an absolute time, it is part of a cache, and the TTL of the RR is compared against the timestamp for the start of the request.</p>
<p>Note that using the timestamp is superior to using a current time, since it allows RRs with TTLs of zero to be entered in the cache in the usual manner, but still used by the current request, even after intervals of many seconds due to system load, query retransmission timeouts, etc.</p>
</li>
<li><p>Some sort of parameters to limit the amount of work which will be performed for this request.</p>
<p>The amount of work which a resolver will do in response to a client request must be limited to guard against errors in the database, such as circular CNAME references, and operational problems, such as network partition which prevents the resolver from accessing the name servers it needs.  While local limits on the number of times a resolver will retransmit  a particular query to a particular name server address are essential, the resolver should have a global per-request counter to limit work on a single request.  The counter should be set to some initial value and decremented whenever the resolver performs any action (retransmission timeout, retransmission, etc.)  If the counter passes zero, the request is terminated with a temporary error.</p>
<p>Note that if the resolver structure allows one request to start others in parallel, such as when the need to access a name server for one request causes a parallel resolve for the name server’s addresses, the spawned request should be started with a lower counter.  This prevents circular references in the database from starting a chain reaction of resolver activity.</p>
</li>
<li><p>The SLIST data structure discussed in [RFC-1034].</p>
<p>This structure keeps track of the state of a request if it must wait for answers from foreign name servers.</p>
</li>
</ul>
<h2 id="7-2-Sending-the-queries-发送查询"><a href="#7-2-Sending-the-queries-发送查询" class="headerlink" title="7.2. Sending the queries(发送查询)"></a>7.2. Sending the queries(发送查询)</h2><p>As described in [RFC-1034], the basic task of the resolver is to formulate a query which will answer the client’s request and direct that query to name servers which can provide the information.  The resolver will usually only have very strong hints about which servers to ask, in the form of NS RRs, and may have to revise the query, in response to CNAMEs, or revise the set of name servers the resolver is asking, in response to delegation responses which point the resolver to name servers closer to the desired information.  In addition to the information requested by the client, the resolver may have to call upon its own services to determine the address of name servers it wishes to contact.</p>
<p>In any case, the model used in this memo assumes that the resolver is multiplexing attention between multiple requests, some from the client, and some internally generated.  Each request is represented by some state information, and the desired behavior is that the resolver transmit queries to name servers in a way that maximizes the probability that the request is answered, minimizes the time that the request takes, and avoids excessive transmissions.  The key algorithm uses the state information of the request to select the next name server address to query, and also computes a timeout which will cause the next action should a response not arrive.  The next action will usually be a transmission to some other server, but may be a temporary error to the client.</p>
<p>The resolver always starts with a list of server names to query (SLIST). This list will be all NS RRs which correspond to the nearest ancestor zone that the resolver knows about.  To avoid startup problems, the resolver should have a set of default servers which it will ask should it have no current NS RRs which are appropriate.  The resolver then adds to SLIST all of the known addresses for the name servers, and may start parallel requests to acquire the addresses of the servers when the resolver has the name, but no addresses, for the name servers.</p>
<p>To complete initialization of SLIST, the resolver attaches whatever history information it has to the each address in SLIST.  This will usually consist of some sort of weighted averages for the response time of the address, and the batting average of the address (i.e., how often the address responded at all to the request).  Note that this information should be kept on a per address basis, rather than on a per name server basis, because the response time and batting average of a particular server may vary considerably from address to address.  Note also that this information is actually specific to a resolver address / server address pair, so a resolver with multiple addresses may wish to keep separate histories for each of its addresses.  Part of this step must deal with addresses which have no such history; in this case an expected round trip time of 5-10 seconds should be the worst case, with lower estimates for the same local network, etc.</p>
<p>Note that whenever a delegation is followed, the resolver algorithm reinitializes SLIST.</p>
<p>The information establishes a partial ranking of the available name server addresses.  Each time an address is chosen and the state should be altered to prevent its selection again until all other addresses have been tried.  The timeout for each transmission should be 50-100% greater than the average predicted value to allow for variance in response.</p>
<p>Some fine points:</p>
<ul>
<li><p>The resolver may encounter a situation where no addresses are available for any of the name servers named in SLIST, and where the servers in the list are precisely those which would normally be used to look up their own addresses.  This situation typically occurs when the glue address RRs have a smaller TTL than the NS RRs marking delegation, or when the resolver caches the result of a NS search.  The resolver should detect this condition and restart the search at the next ancestor zone, or alternatively at the root.</p>
</li>
<li><p>If a resolver gets a server error or other bizarre response from a name server, it should remove it from SLIST, and may wish to schedule an immediate transmission to the next candidate server address.</p>
</li>
</ul>
<h2 id="7-3-Processing-responses-处理回复"><a href="#7-3-Processing-responses-处理回复" class="headerlink" title="7.3. Processing responses(处理回复)"></a>7.3. Processing responses(处理回复)</h2><p>The first step in processing arriving response datagrams is to parse the response.  This procedure should include:<br><em>处理到达的响应数据报的第一步是解析响应。 该程序应包括：</em></p>
<ul>
<li>Check the header for reasonableness.  Discard datagrams which are queries when responses are expected.</li>
</ul>
<p>   <em>检查应答头是否合理。 当收到应答时,丢弃作为查询的数据报。</em></p>
<ul>
<li>Parse the sections of the message, and insure that all RRs are correctly formatted.</li>
</ul>
<p>   <em>解析消息的各个部分，并确保所有 RR 的格式正确</em></p>
<ul>
<li>As an optional step, check the TTLs of arriving data looking for RRs with excessively long TTLs.  If a RR has an excessively long TTL, say greater than 1 week, either discard the whole response, or limit all TTLs in the response to 1 week.</li>
</ul>
<p>   <em>作为可选步骤，检查到达数据的 TTL，查找 TTL 过长的 RR。 如果 RR 的 TTL 过长（例如超过 1 周），则要么丢弃整个响应，要么将响应中的所有 TTL 限制为 1 周。</em></p>
<p>The next step is to match the response to a current resolver request. The recommended strategy is to do a preliminary matching using the ID field in the domain header, and then to verify that the question section corresponds to the information currently desired.  This requires that the transmission algorithm devote several bits of the domain ID field to a request identifier of some sort.  This step has several fine points:<br><em>下一步是将响应与当前解析器请求进行匹配。 推荐的策略是使用域标头中的 ID 字段进行初步匹配，然后验证问题部分是否对应于当前所需的信息。 这要求传输算法将域 ID 字段的几个位用于某种请求标识符。 这一步有几个要点：</em></p>
<ul>
<li>Some name servers send their responses from different addresses than the one used to receive the query.  That is, a resolver cannot rely that a response will come from the same address which it sent the corresponding query to.  This name server bug is typically encountered in UNIX systems.</li>
</ul>
<p>   <em>一些名称服务器接收和应答的地址不一致的。 也就是说，解析器不能认为响应一定来自其将查询发送到的同一地址。 此名称服务器错误通常在 UNIX 系统中遇到。</em></p>
<ul>
<li>If the resolver retransmits a particular request to a name server it should be able to use a response from any of the transmissions.  However, if it is using the response to sample the round trip time to access the name server, it must be able to determine which transmission matches the response (and keep transmission times for each outgoing message), or only calculate round trip times based on initial transmissions.</li>
</ul>
<p>   <em>如果解析器将特定请求重新传输到名称服务器，它应该能够使用来自任何传输的响应。 但是，如果它使用响应来采样访问名称服务器的往返时间，则它必须能够确定哪个传输与响应匹配（并保留每个传出消息的传输时间），或者仅根据 初始传输。</em></p>
<ul>
<li>A name server will occasionally not have a current copy of a zone which it should have according to some NS RRs.  The resolver should simply remove the name server from the current SLIST, and continue.</li>
</ul>
<p>   <em>名称服务器有时不会拥有根据某些 NS RR 应该拥有的区域的当前副本。 解析器应该简单地从当前 SLIST 中删除名称服务器，然后继续。</em></p>
<h2 id="7-4-Using-the-cache"><a href="#7-4-Using-the-cache" class="headerlink" title="7.4. Using the cache"></a>7.4. Using the cache</h2><p>In general, we expect a resolver to cache all data which it receives in responses since it may be useful in answering future client requests. However, there are several types of data which should not be cached:<br><em>一般来说，我们期望解析器缓存它在响应中收到的所有数据，因为它可能有助于回答未来的客户端请求。 但是，有几种类型的数据不应该被缓存：</em></p>
<ul>
<li>When several RRs of the same type are available for a particular owner name, the resolver should either cache them all or none at all.  When a response is truncated, and a resolver doesn’t know whether it has a complete set, it should not cache a possibly partial set of RRs.</li>
</ul>
<p>   <em>当对于特定的所有者名称存在多个相同类型的资源记录（RR）时，解析器应当要么将它们全部缓存，要么完全不缓存。 当响应被截断，并且解析器不知道它是否具有完整的 RR 集时，它不应该缓存可能部分的 RR 集。</em></p>
<ul>
<li>Cached data should never be used in preference to authoritative data, so if caching would cause this to happen the data should not be cached.</li>
</ul>
<p>   <em>决不应该优先使用缓存数据而不是权威数据，因此如果缓存会导致这种情况发生，则不应缓存数据。</em></p>
<ul>
<li>The results of an inverse query should not be cached.</li>
</ul>
<p>   <em>不应缓存反向查询的结果。</em></p>
<ul>
<li>The results of standard queries where the QNAME contains “*” labels if the data might be used to construct wildcards.  The reason is that the cache does not necessarily contain existing RRs or zone boundary information which is necessary to restrict the application of the wildcard RRs.</li>
</ul>
<p>   <em>标准查询的结果中，如果QNAME包含”</em>“标签且数据可能被用于构建通配符记录，则不应该使用这些数据。原因是缓存中不一定包含限制通配符记录应用所需的现有资源记录或区域边界信息。*</p>
<ul>
<li>RR data in responses of dubious reliability.  When a resolver receives unsolicited responses or RR data other than that requested, it should discard it without caching it.  The basic implication is that all sanity checks on a packet should be performed before any of it is cached.</li>
</ul>
<p>   <em>可靠性可疑的 RR 数据响应。 当解析器收到未经请求的响应或请求之外的 RR 数据时，它应该丢弃它而不缓存它。 基本含义是，应在缓存任何数据包之前对数据包执行所有健全性检查。</em></p>
<p>In a similar vein, when a resolver has a set of RRs for some name in a response, and wants to cache the RRs, it should check its cache for already existing RRs.  Depending on the circumstances, either the data in the response or the cache is preferred, but the two should never be combined.  If the data in the response is from authoritative data in the answer section, it is always preferred.<br><em>类类似地，当解析器在某个响应中获得了一组某个名称的资源记录（RR），并希望缓存这些记录时，它应检查缓存中是否已有存在的资源记录。根据具体情况，可以选择优先使用响应中的数据或者缓存中的数据，但绝不应将两者合并。如果响应中的数据来自应答部分的权威数据，则应始终优先使用。</em></p>
<h1 id="8-MAIL-SUPPORT-邮件支持"><a href="#8-MAIL-SUPPORT-邮件支持" class="headerlink" title="8. MAIL SUPPORT(邮件支持)"></a>8. MAIL SUPPORT(邮件支持)</h1><p>The domain system defines a standard for mapping mailboxes into domain names, and two methods for using the mailbox information to derive mail routing information.  The first method is called mail exchange binding and the other method is mailbox binding.  The mailbox encoding standard and mail exchange binding are part of the DNS official protocol, and are the recommended method for mail routing in the Internet.  Mailbox binding is an experimental feature which is still under development and subject to change.</p>
<p>The mailbox encoding standard assumes a mailbox name of the form “<local-part>@<mail-domain>“.  While the syntax allowed in each of these sections varies substantially between the various mail internets, the preferred syntax for the ARPA Internet is given in [RFC-822].</p>
<p>The DNS encodes the <local-part> as a single label, and encodes the <mail-domain> as a domain name.  The single label from the <local-part> is prefaced to the domain name from <mail-domain> to form the domain name corresponding to the mailbox.  Thus the mailbox <a href="mailto:&#x48;&#x4f;&#x53;&#x54;&#77;&#x41;&#83;&#84;&#x45;&#82;&#x40;&#83;&#x52;&#x49;&#45;&#x4e;&#73;&#x43;&#x2e;&#x41;&#x52;&#x50;&#x41;">&#x48;&#x4f;&#x53;&#x54;&#77;&#x41;&#83;&#84;&#x45;&#82;&#x40;&#83;&#x52;&#x49;&#45;&#x4e;&#73;&#x43;&#x2e;&#x41;&#x52;&#x50;&#x41;</a> is mapped into the domain name HOSTMASTER.SRI-NIC.ARPA.  If the <local-part> contains dots or other special characters, its  representation in a master file will require the use of backslash quoting to ensure that the domain name is properly encoded.  For example, the mailbox <a href="mailto:&#x41;&#x63;&#x74;&#x69;&#x6f;&#110;&#x2e;&#x64;&#x6f;&#109;&#97;&#105;&#110;&#x73;&#x40;&#73;&#83;&#73;&#46;&#69;&#68;&#85;">&#x41;&#x63;&#x74;&#x69;&#x6f;&#110;&#x2e;&#x64;&#x6f;&#109;&#97;&#105;&#110;&#x73;&#x40;&#73;&#83;&#73;&#46;&#69;&#68;&#85;</a> would be represented as Action.domains.ISI.EDU.</p>
<h2 id="8-1-Mail-exchange-binding-邮件交换绑定"><a href="#8-1-Mail-exchange-binding-邮件交换绑定" class="headerlink" title="8.1. Mail exchange binding(邮件交换绑定)"></a>8.1. Mail exchange binding(邮件交换绑定)</h2><p>Mail exchange binding uses the <mail-domain> part of a mailbox specification to determine where mail should be sent.  The <local-part> is not even consulted.  [RFC-974] specifies this method in detail, and should be consulted before attempting to use mail exchange support.</p>
<p>One of the advantages of this method is that it decouples mail destination naming from the hosts used to support mail service, at the cost of another layer of indirection in the lookup function.  However, the addition layer should eliminate the need for complicated “%”, “!”, etc encodings in <local-part>.</p>
<p>The essence of the method is that the <mail-domain> is used as a domain name to locate type MX RRs which list hosts willing to accept mail for <mail-domain>, together with preference values which rank the hosts according to an order specified by the administrators for <mail-domain>.</p>
<p>In this memo, the <mail-domain> ISI.EDU is used in examples, together with the hosts VENERA.ISI.EDU and VAXA.ISI.EDU as mail exchanges for ISI.EDU.  If a mailer had a message for <a href="mailto:&#x4d;&#111;&#99;&#107;&#97;&#x70;&#101;&#x74;&#x72;&#105;&#115;&#x40;&#73;&#83;&#x49;&#x2e;&#x45;&#x44;&#85;">&#x4d;&#111;&#99;&#107;&#97;&#x70;&#101;&#x74;&#x72;&#105;&#115;&#x40;&#73;&#83;&#x49;&#x2e;&#x45;&#x44;&#85;</a>, it would route it by looking up MX RRs for ISI.EDU.  The MX RRs at ISI.EDU name VENERA.ISI.EDU and VAXA.ISI.EDU, and type A queries can find the host addresses.</p>
<h2 id="8-2-Mailbox-binding-Experimental-邮箱绑定（实验）"><a href="#8-2-Mailbox-binding-Experimental-邮箱绑定（实验）" class="headerlink" title="8.2. Mailbox binding (Experimental) (邮箱绑定（实验）)"></a>8.2. Mailbox binding (Experimental) (邮箱绑定（实验）)</h2><p>In mailbox binding, the mailer uses the entire mail destination specification to construct a domain name.  The encoded domain name for the mailbox is used as the QNAME field in a QTYPE=MAILB query.</p>
<p>Several outcomes are possible for this query:</p>
<ol>
<li><p>The query can return a name error indicating that the mailbox does not exist as a domain name.</p>
<p>In the long term, this would indicate that the specified mailbox doesn’t exist.  However, until the use of mailbox binding is universal, this error condition should be interpreted to mean that the organization identified by the global part does not support mailbox binding.  The appropriate procedure is to revert to exchange binding atthis point.</p>
</li>
<li><p>The query can return a Mail Rename (MR) RR.</p>
<p>The MR RR carries new mailbox specification in its RDATA field.  The mailer should replace the old mailbox with the new one and retry the operation.</p>
</li>
<li><p>The query can return a MB RR.</p>
<p>The MB RR carries a domain name for a host in its RDATA field.  The mailer should deliver the message to that host via whatever protocol is applicable, e.g., b,SMTP.</p>
</li>
<li><p>The query can return one or more Mail Group (MG) RRs.</p>
<p>This condition means that the mailbox was actually a mailing list or mail group, rather than a single mailbox.  Each MG RR has a RDATA field that identifies a mailbox that is a member of the group.  The mailer should deliver a copy of the message to each member.</p>
</li>
<li><p>The query can return a MB RR as well as one or more MG RRs.</p>
<p>This condition means the the mailbox was actually a mailing list.  The mailer can either deliver the message to the host specified by the MB RR, which will in turn do the delivery to all members, or the mailer can use the MG RRs to do the expansion itself.</p>
</li>
</ol>
<p>In any of these cases, the response may include a Mail Information (MINFO) RR.  This RR is usually associated with a mail group, but is legal with a MB.  The MINFO RR identifies two mailboxes.  One of these identifies a responsible person for the original mailbox name.  This mailbox should be used for requests to be added to a mail group, etc. The second mailbox name in the MINFO RR identifies a mailbox that should receive error messages for mail failures.  This is particularly appropriate for mailing lists when errors in member names should be reported to a person other than the one who sends a message to the list.</p>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/devops/">devops</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/dns/">dns</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2023/08/10/03%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91/03linux/22-rfc1034/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">RFC1034(域名 - 概念和设施)</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2023/08/10/03%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91/03linux/21-rfc1035-bak/">
                        <span class="hidden-mobile"></span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  <script  src="/js/local-search.js" ></script>



  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  
    <script  src="https://cdn.jsdelivr.net/npm/tocbot@4/dist/tocbot.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3/dist/jquery.fancybox.min.js" ></script>
  
  
    <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4/anchor.min.js" ></script>
  
  
    <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js" ></script>
  






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
        typing(title);
      
    })(window, document);
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
